java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable, StreamCapabilities@LimitedPrivate("HDFS")
@Unstable
public abstract class FSOutputSummer
extends java.io.OutputStream
implements StreamCapabilities
StreamCapabilities.StreamCapabilityABORTABLE_STREAM, DROPBEHIND, HFLUSH, HSYNC, IOSTATISTICS, IOSTATISTICS_CONTEXT, PREADBYTEBUFFER, READAHEAD, READBYTEBUFFER, UNBUFFER, VECTOREDIO| Modifier | Constructor | Description |
|---|---|---|
protected |
FSOutputSummer(DataChecksum sum) |
| Modifier and Type | Method | Description |
|---|---|---|
protected abstract void |
checkClosed() |
Check if the implementing OutputStream is closed and should no longer
accept writes.
|
static byte[] |
convertToByteStream(java.util.zip.Checksum sum,
int checksumSize) |
Converts a checksum integer value to a byte stream
|
protected org.apache.hadoop.tracing.TraceScope |
createWriteTraceScope() |
|
void |
flush() |
Checksums all complete data chunks and flushes them to the underlying
stream.
|
protected void |
flushBuffer() |
|
protected int |
flushBuffer(boolean keep,
boolean flushPartial) |
|
protected int |
getBufferedDataSize() |
Return the number of valid bytes currently in the buffer.
|
protected int |
getChecksumSize() |
|
protected DataChecksum |
getDataChecksum() |
|
boolean |
hasCapability(java.lang.String capability) |
Query the stream for a specific capability.
|
protected void |
resetChecksumBufSize() |
|
protected void |
setChecksumBufSize(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 bOffset,
int bLen,
byte[] checksum,
int checksumOffset,
int checksumLen) |
protected FSOutputSummer(DataChecksum sum)
protected abstract void writeChunk(byte[] b,
int bOffset,
int bLen,
byte[] checksum,
int checksumOffset,
int checksumLen)
throws java.io.IOException
java.io.IOExceptionprotected abstract void checkClosed()
throws java.io.IOException
IOException if it is closed.java.io.IOException - if this stream is already closed.public void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(byte[] b,
int off,
int len)
throws java.io.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 unnecessary data copy.
write in class java.io.OutputStreamb - the data.off - the start offset in the data.len - the number of bytes to write.java.io.IOException - if an I/O error occurs.protected void flushBuffer()
throws java.io.IOException
java.io.IOExceptionprotected int flushBuffer(boolean keep,
boolean flushPartial)
throws java.io.IOException
java.io.IOExceptionpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOExceptionprotected int getBufferedDataSize()
protected int getChecksumSize()
protected DataChecksum getDataChecksum()
protected org.apache.hadoop.tracing.TraceScope createWriteTraceScope()
public static byte[] convertToByteStream(java.util.zip.Checksum sum,
int checksumSize)
sum - check sum.checksumSize - check sum size.protected void setChecksumBufSize(int size)
size - size.protected void resetChecksumBufSize()
public boolean hasCapability(java.lang.String capability)
StreamCapabilitieshasCapability in interface StreamCapabilitiescapability - string to query the stream support for.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.