|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.OutputStream org.apache.hadoop.fs.FSOutputSummer
public abstract class FSOutputSummer
This is a generic output stream for generating checksums for data before it is written to the underlying stream
Constructor Summary | |
---|---|
protected |
FSOutputSummer(Checksum sum,
int maxChunkSize,
int checksumSize)
|
Method Summary | |
---|---|
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)
|
Methods inherited from class java.io.OutputStream |
---|
close, flush, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected FSOutputSummer(Checksum sum, int maxChunkSize, int checksumSize)
Method Detail |
---|
protected abstract void writeChunk(byte[] b, int offset, int len, byte[] checksum) throws IOException
IOException
public void write(int b) throws IOException
write
in class 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
in class 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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |