C# Class ICSharpCode.SharpZipLib.Tar.TarInputStream

The TarInputStream reads a UNIX tar archive as an InputStream. methods are provided to position at each successive entry in the archive, and the read each entry as a normal input stream using read().
Inheritance: Stream
Afficher le fichier Open project: icsharpcode/SharpZipLib Class Usage Examples

Protected Properties

Свойство Type Description
entryFactory IEntryFactory
entryOffset long
entrySize long
hasHitEOF bool
readBuffer byte[]
tarBuffer TarBuffer

Méthodes publiques

Méthode Description
CopyEntryContents ( Stream outputStream ) : void

Copies the contents of the current tar archive entry directly into an output stream.

Flush ( ) : void

Flushes the baseInputStream

GetNextEntry ( ) : TarEntry

Get the next entry in this tar archive. This will skip over any remaining data in the current entry, if there is one, and place the input stream at the header of the next entry, and read the header and instantiate a new TarEntry from the header bytes and return that entry. If there are no more entries in the archive, null will be returned to indicate that the end of the archive has been reached.

Mark ( int markLimit ) : void

Since we do not support marking just yet, we do nothing.

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

Reads bytes from the current tar archive entry. This method is aware of the boundaries of the current entry in the archive and will deal with them appropriately

ReadByte ( ) : int

Reads a byte from the current tar archive entry.

Reset ( ) : void

Since we do not support marking just yet, we do nothing.

Seek ( long offset, SeekOrigin origin ) : long

Set the streams position. This operation is not supported and will throw a NotSupportedException

SetEntryFactory ( IEntryFactory factory ) : void

Set the entry factory for this instance.

SetLength ( long value ) : void

Sets the length of the stream This operation is not supported and will throw a NotSupportedException

Skip ( long skipCount ) : void

Skip bytes in the input buffer. This skips bytes in the current entry's data, not the entire archive, and will stop at the end of the current entry's data if the number to skip extends beyond that point.

TarInputStream ( Stream inputStream ) : System

Construct a TarInputStream with default block factor

TarInputStream ( Stream inputStream, int blockFactor ) : System

Construct a TarInputStream with user specified block factor

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

Writes a block of bytes to this stream using data from a buffer. This operation is not supported and will throw a NotSupportedException

WriteByte ( byte value ) : void

Writes a byte to the current position in the file stream. This operation is not supported and will throw a NotSupportedException

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void

Closes this stream. Calls the TarBuffer's close() method. The underlying stream is closed by the TarBuffer.

SkipToNextEntry ( ) : void

Private Methods

Méthode Description
GetRecordSize ( ) : int

Method Details

CopyEntryContents() public méthode

Copies the contents of the current tar archive entry directly into an output stream.
public CopyEntryContents ( Stream outputStream ) : void
outputStream Stream /// The OutputStream into which to write the entry's data. ///
Résultat void

Dispose() protected méthode

Closes this stream. Calls the TarBuffer's close() method. The underlying stream is closed by the TarBuffer.
protected Dispose ( bool disposing ) : void
disposing bool
Résultat void

Flush() public méthode

Flushes the baseInputStream
public Flush ( ) : void
Résultat void

GetNextEntry() public méthode

Get the next entry in this tar archive. This will skip over any remaining data in the current entry, if there is one, and place the input stream at the header of the next entry, and read the header and instantiate a new TarEntry from the header bytes and return that entry. If there are no more entries in the archive, null will be returned to indicate that the end of the archive has been reached.
public GetNextEntry ( ) : TarEntry
Résultat TarEntry

Mark() public méthode

Since we do not support marking just yet, we do nothing.
public Mark ( int markLimit ) : void
markLimit int /// The limit to mark. ///
Résultat void

Read() public méthode

Reads bytes from the current tar archive entry. This method is aware of the boundaries of the current entry in the archive and will deal with them appropriately
public Read ( byte buffer, int offset, int count ) : int
buffer byte /// The buffer into which to place bytes read. ///
offset int /// The offset at which to place bytes read. ///
count int /// The number of bytes to read. ///
Résultat int

ReadByte() public méthode

Reads a byte from the current tar archive entry.
public ReadByte ( ) : int
Résultat int

Reset() public méthode

Since we do not support marking just yet, we do nothing.
public Reset ( ) : void
Résultat void

Seek() public méthode

Set the streams position. This operation is not supported and will throw a NotSupportedException
Any access
public Seek ( long offset, SeekOrigin origin ) : long
offset long The offset relative to the origin to seek to.
origin SeekOrigin The to start seeking from.
Résultat long

SetEntryFactory() public méthode

Set the entry factory for this instance.
public SetEntryFactory ( IEntryFactory factory ) : void
factory IEntryFactory The factory for creating new entries
Résultat void

SetLength() public méthode

Sets the length of the stream This operation is not supported and will throw a NotSupportedException
Any access
public SetLength ( long value ) : void
value long The new stream length.
Résultat void

Skip() public méthode

Skip bytes in the input buffer. This skips bytes in the current entry's data, not the entire archive, and will stop at the end of the current entry's data if the number to skip extends beyond that point.
public Skip ( long skipCount ) : void
skipCount long /// The number of bytes to skip. ///
Résultat void

SkipToNextEntry() protected méthode

protected SkipToNextEntry ( ) : void
Résultat void

TarInputStream() public méthode

Construct a TarInputStream with default block factor
public TarInputStream ( Stream inputStream ) : System
inputStream Stream stream to source data from
Résultat System

TarInputStream() public méthode

Construct a TarInputStream with user specified block factor
public TarInputStream ( Stream inputStream, int blockFactor ) : System
inputStream Stream stream to source data from
blockFactor int block factor to apply to archive
Résultat System

Write() public méthode

Writes a block of bytes to this stream using data from a buffer. This operation is not supported and will throw a NotSupportedException
Any access
public Write ( byte buffer, int offset, int count ) : void
buffer byte The buffer containing bytes to write.
offset int The offset in the buffer of the frist byte to write.
count int The number of bytes to write.
Résultat void

WriteByte() public méthode

Writes a byte to the current position in the file stream. This operation is not supported and will throw a NotSupportedException
Any access
public WriteByte ( byte value ) : void
value byte The byte value to write.
Résultat void

Property Details

entryFactory protected_oe property

Factory used to create TarEntry or descendant class instance
protected IEntryFactory entryFactory
Résultat IEntryFactory

entryOffset protected_oe property

Number of bytes read for this entry so far
protected long entryOffset
Résultat long

entrySize protected_oe property

Size of this entry as recorded in header
protected long entrySize
Résultat long

hasHitEOF protected_oe property

Flag set when last block has been read
protected bool hasHitEOF
Résultat bool

readBuffer protected_oe property

Buffer used with calls to Read()
protected byte[] readBuffer
Résultat byte[]

tarBuffer protected_oe property

Working buffer
protected TarBuffer,ICSharpCode.SharpZipLib.Tar tarBuffer
Résultat TarBuffer