Class FixedLengthBlockOutputStream

java.lang.Object
java.io.OutputStream
org.apache.commons.compress.utils.FixedLengthBlockOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, Channel, WritableByteChannel

This class supports writing to an OutputStream or WritableByteChannel in fixed length blocks.

It can be be used to support output to devices such as tape drives that require output in this format. If the final block does not have enough content to fill an entire block, the output will be padded to a full block size.

This class can be used to support TAR,PAX, and CPIO blocked output to character special devices. It is not recommended that this class be used unless writing to such devices, as the padding serves no useful purpose in such cases.

This class should normally wrap a FileOutputStream or associated WritableByteChannel directly. If there is an intervening filter that modified the output, such as a CompressorOutputStream, or performs its own buffering, such as BufferedOutputStream, output to the device may no longer be of the specified size.

Any content written to this stream should be self-delimiting and should tolerate any padding added to fill the last block.

Since:
1.15