org.apache.commons.compress.archivers.ar
Class ArArchiveOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.commons.compress.archivers.ArchiveOutputStream
          extended by org.apache.commons.compress.archivers.ar.ArArchiveOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class ArArchiveOutputStream
extends ArchiveOutputStream

Implements the "ar" archive format as an output stream.

This class is not thread-safe

Constructor Summary
ArArchiveOutputStream(OutputStream pOut)
           
 
Method Summary
 void close()
          Calls finish if necessary, and then closes the OutputStream
 void closeArchiveEntry()
          Closes the archive entry, writing any trailer information that may be required.
 ArchiveEntry createArchiveEntry(File inputFile, String entryName)
          Create an archive entry using the inputFile and entryName provided.
 void finish()
          Finishes the addition of entries to this stream, without closing it.
 void putArchiveEntry(ArchiveEntry pEntry)
          Writes the headers for an archive entry to the output stream.
 void write(byte[] b, int off, int len)
           
 
Methods inherited from class org.apache.commons.compress.archivers.ArchiveOutputStream
canWriteEntryData, count, count, getBytesWritten, getCount, write
 
Methods inherited from class java.io.OutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArArchiveOutputStream

public ArArchiveOutputStream(OutputStream pOut)
Method Detail

closeArchiveEntry

public void closeArchiveEntry()
                       throws IOException
Closes the archive entry, writing any trailer information that may be required.

Specified by:
closeArchiveEntry in class ArchiveOutputStream
Throws:
IOException

putArchiveEntry

public void putArchiveEntry(ArchiveEntry pEntry)
                     throws IOException
Writes the headers for an archive entry to the output stream. The caller must then write the content to the stream and call ArchiveOutputStream.closeArchiveEntry() to complete the process.

Specified by:
putArchiveEntry in class ArchiveOutputStream
Parameters:
pEntry - describes the entry
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

close

public void close()
           throws IOException
Calls finish if necessary, and then closes the OutputStream

Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException

createArchiveEntry

public ArchiveEntry createArchiveEntry(File inputFile,
                                       String entryName)
                                throws IOException
Create an archive entry using the inputFile and entryName provided.

Specified by:
createArchiveEntry in class ArchiveOutputStream
Returns:
the ArchiveEntry set up with details from the file
Throws:
IOException

finish

public void finish()
            throws IOException
Finishes the addition of entries to this stream, without closing it. Additional data can be written, if the format supports it. The finish() method throws an Exception if the user forgets to close the entry .

Specified by:
finish in class ArchiveOutputStream
Throws:
IOException


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.