C# Класс 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().
Наследование: Stream
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
assemblyBuffer byte[]
blockBuffer byte[]
buffer TarBuffer
currSize long
outputStream Stream

Private Properties

Свойство Тип Описание
GetRecordSize int

Открытые методы

Метод Описание
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).

Защищенные методы

Метод Описание
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.

Приватные методы

Метод Описание
GetRecordSize ( ) : int

Описание методов

CloseEntry() публичный Метод

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
Результат void

Dispose() защищенный Метод

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
Результат void

Finish() публичный Метод

Ends the TAR archive without closing the underlying OutputStream. The result is that the EOF block of nulls is written.
public Finish ( ) : void
Результат void

Flush() публичный Метод

All buffered data is written to destination
public Flush ( ) : void
Результат void

PutNextEntry() публичный Метод

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. ///
Результат void

Read() публичный Метод

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.
Результат int

ReadByte() публичный Метод

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
Результат int

Seek() публичный Метод

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.
Результат long

SetLength() публичный Метод

Set the length of the current stream
public SetLength ( long value ) : void
value long The new stream length.
Результат void

TarOutputStream() публичный Метод

Construct TarOutputStream using default block factor
public TarOutputStream ( Stream outputStream ) : System
outputStream Stream stream to write to
Результат System

TarOutputStream() публичный Метод

Construct TarOutputStream with user specified block factor
public TarOutputStream ( Stream outputStream, int blockFactor ) : System
outputStream Stream stream to write to
blockFactor int blocking factor
Результат System

Write() публичный Метод

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. ///
Результат void

WriteByte() публичный Метод

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. ///
Результат void

WriteEofBlock() защищенный Метод

Write an EOF (end of archive) block to the tar archive. An EOF block consists of all zeros.
protected WriteEofBlock ( ) : void
Результат void

Описание свойств

assemblyBuffer защищенное свойство

'Assembly' buffer used to assemble data before writing
protected byte[] assemblyBuffer
Результат byte[]

blockBuffer защищенное свойство

single block working buffer
protected byte[] blockBuffer
Результат byte[]

buffer защищенное свойство

TarBuffer used to provide correct blocking factor
protected TarBuffer,ICSharpCode.SharpZipLib.Tar buffer
Результат TarBuffer

currSize защищенное свойство

Size for the current entry
protected long currSize
Результат long

outputStream защищенное свойство

the destination stream for the archive contents
protected Stream outputStream
Результат Stream