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
파일 보기 프로젝트 열기: icsharpcode/SharpZipLib 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
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