# Class TarOutputStream

java.lang.Object
java.io.OutputStream
com.codename1.io.BufferedOutputStream
com.codename1.io.tar.TarOutputStream

All Implemented Interfaces:
  `AutoCloseable`

public class TarOutputStream extends BufferedOutputStream

- ## Field Summary

  ### Fields inherited from class BufferedOutputStream

  `buf, count`
  Modifier and Type
  Field
  Description
  `protected byte[]`
  `buf`
  The internal buffer where data is stored.
  `protected int`
  `count`
  The number of valid bytes in the buffer.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TarOutputStream(OutputStream out)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Appends the EOF record and closes the stream
  `protected void`
  `closeCurrentEntry()`
  Closes the current tar entry
  `protected void`
  `pad()`
  Pads the last content block
  `void`
  `putNextEntry(TarEntry entry)`
  Writes the next tar entry header on the stream
  `void`
  `write(byte[] b, int off, int len)`
  Checks if the bytes being written exceed the current entry size.
  `void`
  `write(int b)`
  Writes a byte to the stream and updates byte counters

  ### Methods inherited from class BufferedOutputStream

  `flush, flushBuffer, getConnection, getDefaultBufferSize, getLastActivityTime, getName, getTotalBytesWritten, setConnection, setDefaultBufferSize, setProgressListener, write`
  Modifier and Type
  Method
  Description
  `void`
  `flush()`
  Flushes this buffered output stream.
  `void`
  `flushBuffer()`
  Flush the internal buffer
  `Object`
  `getConnection()`
  If applicable this member represents the connection object for the stream
  `static int`
  `getDefaultBufferSize()`
  The default size for a stream buffer
  `long`
  `getLastActivityTime()`
  Returns the time of the last activity
  `String`
  `getName()`
  Indicates the name of the stream for debugging purposes
  `int`
  `getTotalBytesWritten()`
  Returns the total amount of bytes written to this stream so far
  `void`
  `setConnection(Object connection)`
  If applicable this member represents the connection object for the stream
  `static void`
  `setDefaultBufferSize(int aDefaultBufferSize)`
  The default size for a stream buffer
  `void`
  `setProgressListener(IOProgressListener progressListener)`
  Sets the callback for IO updates from a buffered stream
  `void`
  `write(byte[] b)`
  Writes `b.length` bytes to this output stream.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `final Class`
  `getClass()`
  Returns the runtime class of an object.
  `int`
  `hashCode()`
  Returns a hash code value for the object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes current thread to wait until another thread invokes the method or the method for this object.
  `final void`
  `wait(long timeout)`
  Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
  `final void`
  `wait(long timeout, int nanos)`
  Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.

- ## Constructor Details

  - ### TarOutputStream

    public TarOutputStream(OutputStream out)

- ## Method Details

  - ### close

    public void close() throws IOException

    Appends the EOF record and closes the stream

    ###### See also

    - java.io.FilterOutputStream#close()
    Specified by:
      `close` in interface `AutoCloseable`
    Overrides:
      `close` in class `BufferedOutputStream`
    Throws:
      `IOException`

  - ### write

    public void write(int b) throws IOException

    Writes a byte to the stream and updates byte counters

    ###### See also

    - java.io.FilterOutputStream#write(int)
    Overrides:
      `write` in class `BufferedOutputStream`
    Throws:
      `IOException`

  - ### write

    public void write(byte[] b, int off, int len) throws IOException

    Checks if the bytes being written exceed the current entry size.

    ###### See also

    - java.io.FilterOutputStream#write(byte[], int, int)
    Overrides:
      `write` in class `BufferedOutputStream`
    Throws:
      `IOException`

  - ### putNextEntry

    public void putNextEntry(TarEntry entry) throws IOException

    Writes the next tar entry header on the stream

    ###### Parameters

    - `entry`

    ###### Throws

    - `IOException`
    Throws:
      `IOException`

  - ### closeCurrentEntry

    protected void closeCurrentEntry() throws IOException

    Closes the current tar entry

    ###### Throws

    - `IOException`
    Throws:
      `IOException`

  - ### pad

    protected void pad() throws IOException

    Pads the last content block

    ###### Throws

    - `IOException`
    Throws:
      `IOException`