Fingerprint_Card
Loading...
Searching...
No Matches
ICSharpCode.SharpZipLib.Tar.TarInputStream Class Reference

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(). More...

Inheritance diagram for ICSharpCode.SharpZipLib.Tar.TarInputStream:
Collaboration diagram for ICSharpCode.SharpZipLib.Tar.TarInputStream:

Classes

class  EntryFactoryAdapter
 Standard entry factory class creating instances of the class TarEntry. More...
interface  IEntryFactory
 This interface is provided, along with the method SetEntryFactory, to allow the programmer to have their own TarEntry subclass instantiated for the entries return from GetNextEntry. More...

Public Member Functions

 TarInputStream (Stream inputStream)
 Construct a TarInputStream with default block factor.
 TarInputStream (Stream inputStream, int blockFactor)
 Construct a TarInputStream with user specified block factor.
override void Flush ()
 Flushes the baseInputStream.
override long Seek (long offset, SeekOrigin origin)
 Set the streams position. This operation is not supported and will throw a NotSupportedException.
override void SetLength (long value)
 Sets the length of the stream This operation is not supported and will throw a NotSupportedException.
override void Write (byte[] buffer, int offset, int count)
 Writes a block of bytes to this stream using data from a buffer. This operation is not supported and will throw a NotSupportedException.
override void WriteByte (byte value)
 Writes a byte to the current position in the file stream. This operation is not supported and will throw a NotSupportedException.
override int ReadByte ()
 Reads a byte from the current tar archive entry.
override int Read (byte[] buffer, int offset, int count)
 Reads bytes from the current tar archive entry.
override void Close ()
 Closes this stream. Calls the TarBuffer's close() method. The underlying stream is closed by the TarBuffer.
void SetEntryFactory (IEntryFactory factory)
 Set the entry factory for this instance.
int GetRecordSize ()
 Get the record size being used by this stream's TarBuffer.
void Skip (long skipCount)
 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.
void Mark (int markLimit)
 Since we do not support marking just yet, we do nothing.
void Reset ()
 Since we do not support marking just yet, we do nothing.
TarEntry GetNextEntry ()
 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.
void CopyEntryContents (Stream outputStream)
 Copies the contents of the current tar archive entry directly into an output stream.

Protected Attributes

bool hasHitEOF
 Flag set when last block has been read.
long entrySize
 Size of this entry as recorded in header.
long entryOffset
 Number of bytes read for this entry so far.
byte[] readBuffer
 Buffer used with calls to.
TarBuffer tarBuffer
 Working buffer.
IEntryFactory entryFactory
 Factory used to create TarEntry or descendant class instance.

Properties

bool IsStreamOwner [get, set]
 Get/set flag indicating ownership of the underlying stream. When the flag is true Close will close the underlying stream also.
override bool CanRead [get]
 Gets a value indicating whether the current stream supports reading.
override bool CanSeek [get]
 Gets a value indicating whether the current stream supports seeking This property always returns false.
override bool CanWrite [get]
 Gets a value indicating if the stream supports writing. This property always returns false.
override long Length [get]
 The length in bytes of the stream.
override long Position [get, set]
 Gets or sets the position within the stream. Setting the Position is not supported and throws a NotSupportedExceptionNotSupportedException.
int RecordSize [get]
 Get the record size being used by this stream's TarBuffer.
long Available [get]
 Get the available data that can be read from the current entry in the archive. This does not indicate how much data is left in the entire archive, only in the current entry. This value is determined from the entry's size header field and the amount of data already read from the current entry.
bool IsMarkSupported [get]
 Return a value of true if marking is supported; false otherwise.

Private Member Functions

void SkipToNextEntry ()

Private Attributes

TarEntry currentEntry
 Current entry being read.
readonly Stream inputStream
 Stream used as the source of input data.

Detailed Description

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().

Constructor & Destructor Documentation

◆ TarInputStream() [1/2]

ICSharpCode.SharpZipLib.Tar.TarInputStream.TarInputStream ( Stream inputStream)

Construct a TarInputStream with default block factor.

Parameters
inputStreamstream to source data from

◆ TarInputStream() [2/2]

ICSharpCode.SharpZipLib.Tar.TarInputStream.TarInputStream ( Stream inputStream,
int blockFactor )

Construct a TarInputStream with user specified block factor.

Parameters
inputStreamstream to source data from
blockFactorblock factor to apply to archive
Here is the call graph for this function:

Member Function Documentation

◆ Close()

override void ICSharpCode.SharpZipLib.Tar.TarInputStream.Close ( )

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

◆ CopyEntryContents()

void ICSharpCode.SharpZipLib.Tar.TarInputStream.CopyEntryContents ( Stream outputStream)

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

Parameters
outputStreamThe OutputStream into which to write the entry's data.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Flush()

override void ICSharpCode.SharpZipLib.Tar.TarInputStream.Flush ( )

Flushes the baseInputStream.

◆ GetNextEntry()

TarEntry ICSharpCode.SharpZipLib.Tar.TarInputStream.GetNextEntry ( )

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.

Returns
The next TarEntry in the archive, or null.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetRecordSize()

int ICSharpCode.SharpZipLib.Tar.TarInputStream.GetRecordSize ( )

Get the record size being used by this stream's TarBuffer.

Returns
TarBuffer record size.

◆ Mark()

void ICSharpCode.SharpZipLib.Tar.TarInputStream.Mark ( int markLimit)

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

Parameters
markLimitThe limit to mark.

◆ Read()

override int ICSharpCode.SharpZipLib.Tar.TarInputStream.Read ( byte[] buffer,
int offset,
int count )

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

Parameters
bufferThe buffer into which to place bytes read.
offsetThe offset at which to place bytes read.
countThe number of bytes to read.
Returns
The number of bytes read, or 0 at end of stream/EOF.
Here is the caller graph for this function:

◆ ReadByte()

override int ICSharpCode.SharpZipLib.Tar.TarInputStream.ReadByte ( )

Reads a byte from the current tar archive entry.

Returns
A byte cast to an int; -1 if the at the end of the stream.
Here is the call graph for this function:

◆ Reset()

void ICSharpCode.SharpZipLib.Tar.TarInputStream.Reset ( )

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

◆ Seek()

override long ICSharpCode.SharpZipLib.Tar.TarInputStream.Seek ( long offset,
SeekOrigin origin )

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

Parameters
offsetThe offset relative to the origin to seek to.
originThe SeekOrigin to start seeking from.
Returns
The new position in the stream.
Exceptions
NotSupportedExceptionAny access

◆ SetEntryFactory()

void ICSharpCode.SharpZipLib.Tar.TarInputStream.SetEntryFactory ( IEntryFactory factory)

Set the entry factory for this instance.

Parameters
factoryThe factory for creating new entries

◆ SetLength()

override void ICSharpCode.SharpZipLib.Tar.TarInputStream.SetLength ( long value)

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

Parameters
valueThe new stream length.
Exceptions
NotSupportedExceptionAny access

◆ Skip()

void ICSharpCode.SharpZipLib.Tar.TarInputStream.Skip ( long skipCount)

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.

Parameters
skipCountThe number of bytes to skip.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SkipToNextEntry()

void ICSharpCode.SharpZipLib.Tar.TarInputStream.SkipToNextEntry ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Write()

override void ICSharpCode.SharpZipLib.Tar.TarInputStream.Write ( byte[] buffer,
int offset,
int count )

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

Parameters
bufferThe buffer containing bytes to write.
offsetThe offset in the buffer of the frist byte to write.
countThe number of bytes to write.
Exceptions
NotSupportedExceptionAny access

◆ WriteByte()

override void ICSharpCode.SharpZipLib.Tar.TarInputStream.WriteByte ( byte value)

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

Parameters
valueThe byte value to write.
Exceptions
NotSupportedExceptionAny access

Member Data Documentation

◆ currentEntry

TarEntry ICSharpCode.SharpZipLib.Tar.TarInputStream.currentEntry
private

Current entry being read.

◆ entryFactory

IEntryFactory ICSharpCode.SharpZipLib.Tar.TarInputStream.entryFactory
protected

Factory used to create TarEntry or descendant class instance.

◆ entryOffset

long ICSharpCode.SharpZipLib.Tar.TarInputStream.entryOffset
protected

Number of bytes read for this entry so far.

◆ entrySize

long ICSharpCode.SharpZipLib.Tar.TarInputStream.entrySize
protected

Size of this entry as recorded in header.

◆ hasHitEOF

bool ICSharpCode.SharpZipLib.Tar.TarInputStream.hasHitEOF
protected

Flag set when last block has been read.

◆ inputStream

readonly Stream ICSharpCode.SharpZipLib.Tar.TarInputStream.inputStream
private

Stream used as the source of input data.

◆ readBuffer

byte [] ICSharpCode.SharpZipLib.Tar.TarInputStream.readBuffer
protected

Buffer used with calls to.

override int Read(byte[] buffer, int offset, int count)
Reads bytes from the current tar archive entry.
Definition TarInputStream.cs:226

◆ tarBuffer

TarBuffer ICSharpCode.SharpZipLib.Tar.TarInputStream.tarBuffer
protected

Working buffer.

Property Documentation

◆ Available

long ICSharpCode.SharpZipLib.Tar.TarInputStream.Available
get

Get the available data that can be read from the current entry in the archive. This does not indicate how much data is left in the entire archive, only in the current entry. This value is determined from the entry's size header field and the amount of data already read from the current entry.

Returns
The number of available bytes for the current entry.

◆ CanRead

override bool ICSharpCode.SharpZipLib.Tar.TarInputStream.CanRead
get

Gets a value indicating whether the current stream supports reading.

◆ CanSeek

override bool ICSharpCode.SharpZipLib.Tar.TarInputStream.CanSeek
get

Gets a value indicating whether the current stream supports seeking This property always returns false.

◆ CanWrite

override bool ICSharpCode.SharpZipLib.Tar.TarInputStream.CanWrite
get

Gets a value indicating if the stream supports writing. This property always returns false.

◆ IsMarkSupported

bool ICSharpCode.SharpZipLib.Tar.TarInputStream.IsMarkSupported
get

Return a value of true if marking is supported; false otherwise.

Currently marking is not supported, the return value is always false.

◆ IsStreamOwner

bool ICSharpCode.SharpZipLib.Tar.TarInputStream.IsStreamOwner
getset

Get/set flag indicating ownership of the underlying stream. When the flag is true Close will close the underlying stream also.

◆ Length

override long ICSharpCode.SharpZipLib.Tar.TarInputStream.Length
get

The length in bytes of the stream.

◆ Position

override long ICSharpCode.SharpZipLib.Tar.TarInputStream.Position
getset

Gets or sets the position within the stream. Setting the Position is not supported and throws a NotSupportedExceptionNotSupportedException.

Exceptions
NotSupportedExceptionAny attempt to set position

◆ RecordSize

int ICSharpCode.SharpZipLib.Tar.TarInputStream.RecordSize
get

Get the record size being used by this stream's TarBuffer.


The documentation for this class was generated from the following file: