public class TarOutputStream

  1. Object
  2. OutputStream
  3. BufferedOutputStream
  4. TarOutputStream

ImplementsAutoCloseable

Constructors

public TarOutputStream(OutputStream out)

Methods

public void close() throws IOExceptionAppends the EOF record and closes the stream
public void write(int b) throws IOExceptionWrites a byte to the stream and updates byte counters
public void write(byte[] b, int off, int len) throws IOExceptionChecks if the bytes being written exceed the current entry size.
public void putNextEntry(TarEntry entry) throws IOExceptionWrites the next tar entry header on the stream
protected void closeCurrentEntry() throws IOExceptionCloses the current tar entry
protected void pad() throws IOExceptionPads the last content block

Inherited fields

Inherited methods

Constructor details

TarOutputStream

public TarOutputStream(OutputStream out)

Method details

close

public void close() throws IOException
Appends the EOF record and closes the stream

Throws

IOException
if an I/O error occurs.

See also

  • java.io.FilterOutputStream#close()

write

public void write(int b) throws IOException
Writes a byte to the stream and updates byte counters

Parameters

b int
the byte to be written.

Throws

IOException
if an I/O error occurs.

See also

  • java.io.FilterOutputStream#write(int)

write

public void write(byte[] b, int off, int len) throws IOException
Checks if the bytes being written exceed the current entry size.

Parameters

b byte[]
the data.
off int
the start offset in the data.
len int
the number of bytes to write.

Throws

IOException
if an I/O error occurs.

See also

  • java.io.FilterOutputStream#write(byte[], int, int)

putNextEntry

public void putNextEntry(TarEntry entry) throws IOException
Writes the next tar entry header on the stream

closeCurrentEntry

protected void closeCurrentEntry() throws IOException
Closes the current tar entry

pad

protected void pad() throws IOException
Pads the last content block