public abstract class FSOutputSummer extends OutputStream
限定符 | 构造器和说明 |
---|---|
protected |
FSOutputSummer(Checksum sum,
int maxChunkSize,
int checksumSize) |
限定符和类型 | 方法和说明 |
---|---|
static byte[] |
convertToByteStream(Checksum sum,
int checksumSize)
Converts a checksum integer value to a byte stream
|
protected void |
flushBuffer() |
protected void |
flushBuffer(boolean keep) |
protected void |
resetChecksumChunk(int size)
Resets existing buffer with a new one of the specified size.
|
void |
write(byte[] b,
int off,
int len)
Writes
len bytes from the specified byte array
starting at offset off and generate a checksum for
each data chunk. |
void |
write(int b)
Write one byte
|
protected abstract void |
writeChunk(byte[] b,
int offset,
int len,
byte[] checksum) |
close, flush, write
protected FSOutputSummer(Checksum sum, int maxChunkSize, int checksumSize)
protected abstract void writeChunk(byte[] b, int offset, int len, byte[] checksum) throws IOException
IOException
public void write(int b) throws IOException
write
在类中 OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
len
bytes from the specified byte array
starting at offset off
and generate a checksum for
each data chunk.
This method stores bytes from the given array into this stream's buffer before it gets checksumed. The buffer gets checksumed and flushed to the underlying output stream when all data in a checksum chunk are in the buffer. If the buffer is empty and requested length is at least as large as the size of next checksum chunk size, this method will checksum and write the chunk directly to the underlying output stream. Thus it avoids uneccessary data copy.
write
在类中 OutputStream
b
- the data.off
- the start offset in the data.len
- the number of bytes to write.IOException
- if an I/O error occurs.protected void flushBuffer() throws IOException
IOException
protected void flushBuffer(boolean keep) throws IOException
IOException
public static byte[] convertToByteStream(Checksum sum, int checksumSize)
protected void resetChecksumChunk(int size)
Copyright © 2009 The Apache Software Foundation