C# Class ICSharpCode.SharpZipLib.Tar.TarOutputStream

The TarOutputStream writes a UNIX tar archive as an OutputStream. Methods are provided to put entries, and then write their contents by writing to this stream using write().
Inheritance: Stream
Afficher le fichier Open project: icsharpcode/SharpZipLib Class Usage Examples

Protected Properties

Свойство Type Description
assemblyBuffer byte[]
blockBuffer byte[]
buffer TarBuffer
currSize long
outputStream Stream

Private Properties

Свойство Type Description
GetRecordSize int

Méthodes publiques

Méthode Description
CloseEntry ( ) : void

Close an entry. This method MUST be called for all file entries that contain data. The reason is that we must buffer data written to the stream in order to satisfy the buffer's block based writes. Thus, there may be data fragments still being assembled that must be written to the output stream before this entry is closed and the next entry written.

Finish ( ) : void

Ends the TAR archive without closing the underlying OutputStream. The result is that the EOF block of nulls is written.

Flush ( ) : void

All buffered data is written to destination

PutNextEntry ( TarEntry entry ) : void

Put an entry on the output stream. This writes the entry's header and positions the output stream for writing the contents of the entry. Once this method is called, the stream is ready for calls to write() to write the entry's contents. Once the contents are written, closeEntry() MUST be called to ensure that all buffered data is completely written to the output stream.

Read ( byte buffer, int offset, int count ) : int

read bytes from the current stream and advance the position within the stream by the number of bytes read.

ReadByte ( ) : int

Read a byte from the stream and advance the position within the stream by one byte or returns -1 if at the end of the stream.

Seek ( long offset, SeekOrigin origin ) : long

set the position within the current stream

SetLength ( long value ) : void

Set the length of the current stream

TarOutputStream ( Stream outputStream ) : System

Construct TarOutputStream using default block factor

TarOutputStream ( Stream outputStream, int blockFactor ) : System

Construct TarOutputStream with user specified block factor

Write ( byte buffer, int offset, int count ) : void

Writes bytes to the current tar archive entry. This method is aware of the current entry and will throw an exception if you attempt to write bytes past the length specified for the current entry. The method is also (painfully) aware of the record buffering required by TarBuffer, and manages buffers that are not a multiple of recordsize in length, including assembling records from small buffers.

WriteByte ( byte value ) : void

Writes a byte to the current tar archive entry. This method simply calls Write(byte[], int, int).

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void

Ends the TAR archive and closes the underlying OutputStream.

This means that Finish() is called followed by calling the TarBuffer's Close().

WriteEofBlock ( ) : void

Write an EOF (end of archive) block to the tar archive. An EOF block consists of all zeros.

Private Methods

Méthode Description
GetRecordSize ( ) : int

Method Details

CloseEntry() public méthode

Close an entry. This method MUST be called for all file entries that contain data. The reason is that we must buffer data written to the stream in order to satisfy the buffer's block based writes. Thus, there may be data fragments still being assembled that must be written to the output stream before this entry is closed and the next entry written.
public CloseEntry ( ) : void
Résultat void

Dispose() protected méthode

Ends the TAR archive and closes the underlying OutputStream.
This means that Finish() is called followed by calling the TarBuffer's Close().
protected Dispose ( bool disposing ) : void
disposing bool
Résultat void

Finish() public méthode

Ends the TAR archive without closing the underlying OutputStream. The result is that the EOF block of nulls is written.
public Finish ( ) : void
Résultat void

Flush() public méthode

All buffered data is written to destination
public Flush ( ) : void
Résultat void

PutNextEntry() public méthode

Put an entry on the output stream. This writes the entry's header and positions the output stream for writing the contents of the entry. Once this method is called, the stream is ready for calls to write() to write the entry's contents. Once the contents are written, closeEntry() MUST be called to ensure that all buffered data is completely written to the output stream.
public PutNextEntry ( TarEntry entry ) : void
entry TarEntry /// The TarEntry to be written to the archive. ///
Résultat void

Read() public méthode

read bytes from the current stream and advance the position within the stream by the number of bytes read.
public Read ( byte buffer, int offset, int count ) : int
buffer byte The buffer to store read bytes in.
offset int The index into the buffer to being storing bytes at.
count int The desired number of bytes to read.
Résultat int

ReadByte() public méthode

Read a byte from the stream and advance the position within the stream by one byte or returns -1 if at the end of the stream.
public ReadByte ( ) : int
Résultat int

Seek() public méthode

set the position within the current stream
public Seek ( long offset, SeekOrigin origin ) : long
offset long The offset relative to the to seek to
origin SeekOrigin The to seek from.
Résultat long

SetLength() public méthode

Set the length of the current stream
public SetLength ( long value ) : void
value long The new stream length.
Résultat void

TarOutputStream() public méthode

Construct TarOutputStream using default block factor
public TarOutputStream ( Stream outputStream ) : System
outputStream Stream stream to write to
Résultat System

TarOutputStream() public méthode

Construct TarOutputStream with user specified block factor
public TarOutputStream ( Stream outputStream, int blockFactor ) : System
outputStream Stream stream to write to
blockFactor int blocking factor
Résultat System

Write() public méthode

Writes bytes to the current tar archive entry. This method is aware of the current entry and will throw an exception if you attempt to write bytes past the length specified for the current entry. The method is also (painfully) aware of the record buffering required by TarBuffer, and manages buffers that are not a multiple of recordsize in length, including assembling records from small buffers.
public Write ( byte buffer, int offset, int count ) : void
buffer byte /// The buffer to write to the archive. ///
offset int /// The offset in the buffer from which to get bytes. ///
count int /// The number of bytes to write. ///
Résultat void

WriteByte() public méthode

Writes a byte to the current tar archive entry. This method simply calls Write(byte[], int, int).
public WriteByte ( byte value ) : void
value byte /// The byte to be written. ///
Résultat void

WriteEofBlock() protected méthode

Write an EOF (end of archive) block to the tar archive. An EOF block consists of all zeros.
protected WriteEofBlock ( ) : void
Résultat void

Property Details

assemblyBuffer protected_oe property

'Assembly' buffer used to assemble data before writing
protected byte[] assemblyBuffer
Résultat byte[]

blockBuffer protected_oe property

single block working buffer
protected byte[] blockBuffer
Résultat byte[]

buffer protected_oe property

TarBuffer used to provide correct blocking factor
protected TarBuffer,ICSharpCode.SharpZipLib.Tar buffer
Résultat TarBuffer

currSize protected_oe property

Size for the current entry
protected long currSize
Résultat long

outputStream protected_oe property

the destination stream for the archive contents
protected Stream outputStream
Résultat Stream