Fingerprint_Card

Loading...
Searching...
No Matches
ICSharpCode.SharpZipLib.Tar.TarOutputStream Class Reference

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

Inheritance diagram for ICSharpCode.SharpZipLib.Tar.TarOutputStream:
[legend]
Collaboration diagram for ICSharpCode.SharpZipLib.Tar.TarOutputStream:
[legend]

## Public Member Functions
| TarOutputStream (Stream outputStream)
| Construct TarOutputStream using default block factor.
| TarOutputStream (Stream outputStream, int blockFactor)
| Construct TarOutputStream with user specified block factor.
override long | Seek (long offset, SeekOrigin origin)
| set the position within the current stream
override void | SetLength (long value)
| Set the length of the current stream.
override 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.
override int | Read (byte[] buffer, int offset, int count)
| read bytes from the current stream and advance the position within the stream by the number of bytes read.
override void | Flush ()
| All buffered data is written to destination.
void | Finish ()
| Ends the TAR archive without closing the underlying OutputStream. The result is that the EOF block of nulls is written.
override void | Close ()
| Ends the TAR archive and closes the underlying OutputStream.
int | GetRecordSize ()
| Get the record size being used by this stream's TarBuffer.
void | PutNextEntry (TarEntry entry)
| 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.
void | 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.
override void | WriteByte (byte value)
| Writes a byte to the current tar archive entry. This method simply calls Write(byte[], int, int).
override void | Write (byte[] buffer, int offset, int count)
| 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.

## Protected Attributes
long | currSize
| Size for the current entry.
byte[] | blockBuffer
| single block working buffer
byte[] | assemblyBuffer
| 'Assembly' buffer used to assemble data before writing
TarBuffer | buffer
| TarBuffer used to provide correct blocking factor.
Stream | outputStream
| the destination stream for the archive contents

## 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]`
| true if the stream supports reading; otherwise, false.
override bool | CanSeek`[get]`
| true if the stream supports seeking; otherwise, false.
override bool | CanWrite`[get]`
| true if stream supports writing; otherwise, false.
override long | Length`[get]`
| length of stream in bytes
override long | Position`[get, set]`
| gets or sets the position within the current stream.
int | RecordSize`[get]`
| Get the record size being used by this stream's TarBuffer.
bool | IsEntryOpen`[get]`
| Get a value indicating wether an entry is open, requiring more data to be written.

## Private Member Functions
void | WriteEofBlock ()
| Write an EOF (end of archive) block to the tar archive. An EOF block consists of all zeros.

## Private Attributes
long | currBytes
| bytes written for this entry so far
int | assemblyBufferLength
| current 'Assembly' buffer length
bool | isClosed
| Flag indicating wether this instance has been closed or not.

## Detailed Description

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

public

## Constructor & Destructor Documentation

## ◆ TarOutputStream() [1/2]

ICSharpCode.SharpZipLib.Tar.TarOutputStream.TarOutputStream | ( | Stream | outputStream | ) |

Construct TarOutputStream using default block factor.

Parameters

  outputStream | stream to write to

## ◆ TarOutputStream() [2/2]

ICSharpCode.SharpZipLib.Tar.TarOutputStream.TarOutputStream | ( | Stream | outputStream,
|  | int | blockFactor )

Construct TarOutputStream with user specified block factor.

Parameters

  outputStream | stream to write to
  blockFactor | blocking factor

Here is the call graph for this function:

## Member Function Documentation

## ◆ Close()

override void ICSharpCode.SharpZipLib.Tar.TarOutputStream.Close | ( |  | ) |

Ends the TAR archive and closes the underlying OutputStream.

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

Here is the call graph for this function:

## ◆ CloseEntry()

void ICSharpCode.SharpZipLib.Tar.TarOutputStream.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.

Here is the caller graph for this function:

## ◆ Finish()

void ICSharpCode.SharpZipLib.Tar.TarOutputStream.Finish | ( |  | ) |

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

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ Flush()

override void ICSharpCode.SharpZipLib.Tar.TarOutputStream.Flush | ( |  | ) |

All buffered data is written to destination.

## ◆ GetRecordSize()

int ICSharpCode.SharpZipLib.Tar.TarOutputStream.GetRecordSize | ( |  | ) |

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

Returns
  The TarBuffer record size.

## ◆ PutNextEntry()

void ICSharpCode.SharpZipLib.Tar.TarOutputStream.PutNextEntry | ( | TarEntry | entry | ) |

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.

Parameters

  entry | The TarEntry to be written to the archive.

Here is the call graph for this function:

## ◆ Read()

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

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

Parameters

  buffer | The buffer to store read bytes in.
  offset | The index into the buffer to being storing bytes at.
  count | The desired number of bytes to read.

Returns
  The total number of bytes read, or zero if at the end of the stream. The number of bytes may be less than the count count requested if data is not avialable.

## ◆ ReadByte()

override int ICSharpCode.SharpZipLib.Tar.TarOutputStream.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.

Returns
  The byte value or -1 if at end of stream

## ◆ Seek()

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

set the position within the current stream

Parameters

  offset | The offset relative to the origin to seek to
  origin | The SeekOrigin to seek from.

Returns
  The new position in the stream.

## ◆ SetLength()

override void ICSharpCode.SharpZipLib.Tar.TarOutputStream.SetLength | ( | long | value | ) |

Set the length of the current stream.

Parameters

  value | The new stream length.

## ◆ Write()

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

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.

Parameters

  buffer | The buffer to write to the archive.
  offset | The offset in the buffer from which to get bytes.
  count | The number of bytes to write.

Here is the caller graph for this function:

## ◆ WriteByte()

override void ICSharpCode.SharpZipLib.Tar.TarOutputStream.WriteByte | ( | byte | value | ) |

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

Parameters

  value | The byte to be written.

Here is the call graph for this function:

## ◆ WriteEofBlock()

void ICSharpCode.SharpZipLib.Tar.TarOutputStream.WriteEofBlock | ( |  | ) |
| private

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

Here is the caller graph for this function:

## Member Data Documentation

## ◆ assemblyBuffer

byte [] ICSharpCode.SharpZipLib.Tar.TarOutputStream.assemblyBuffer
| protected

'Assembly' buffer used to assemble data before writing

## ◆ assemblyBufferLength

int ICSharpCode.SharpZipLib.Tar.TarOutputStream.assemblyBufferLength
| private

current 'Assembly' buffer length

## ◆ blockBuffer

byte [] ICSharpCode.SharpZipLib.Tar.TarOutputStream.blockBuffer
| protected

single block working buffer

## ◆ buffer

TarBuffer ICSharpCode.SharpZipLib.Tar.TarOutputStream.buffer
| protected

TarBuffer used to provide correct blocking factor.

## ◆ currBytes

long ICSharpCode.SharpZipLib.Tar.TarOutputStream.currBytes
| private

bytes written for this entry so far

## ◆ currSize

long ICSharpCode.SharpZipLib.Tar.TarOutputStream.currSize
| protected

Size for the current entry.

## ◆ isClosed

bool ICSharpCode.SharpZipLib.Tar.TarOutputStream.isClosed
| private

Flag indicating wether this instance has been closed or not.

## ◆ outputStream

Stream ICSharpCode.SharpZipLib.Tar.TarOutputStream.outputStream
| protected

the destination stream for the archive contents

## Property Documentation

## ◆ CanRead

override bool ICSharpCode.SharpZipLib.Tar.TarOutputStream.CanRead
| get

true if the stream supports reading; otherwise, false.

## ◆ CanSeek

override bool ICSharpCode.SharpZipLib.Tar.TarOutputStream.CanSeek
| get

true if the stream supports seeking; otherwise, false.

## ◆ CanWrite

override bool ICSharpCode.SharpZipLib.Tar.TarOutputStream.CanWrite
| get

true if stream supports writing; otherwise, false.

## ◆ IsEntryOpen

bool ICSharpCode.SharpZipLib.Tar.TarOutputStream.IsEntryOpen
| get private

Get a value indicating wether an entry is open, requiring more data to be written.

## ◆ IsStreamOwner

bool ICSharpCode.SharpZipLib.Tar.TarOutputStream.IsStreamOwner
| get set

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.TarOutputStream.Length
| get

length of stream in bytes

## ◆ Position

override long ICSharpCode.SharpZipLib.Tar.TarOutputStream.Position
| get set

gets or sets the position within the current stream.

## ◆ RecordSize

int ICSharpCode.SharpZipLib.Tar.TarOutputStream.RecordSize
| get

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

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

- ICSharpCode.SharpZLib/Tar/TarOutputStream.cs