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...
|
| | 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.
|
|
| 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.
|
|
| void | WriteEofBlock () |
| | Write an EOF (end of archive) block to the tar archive. An EOF block consists of all zeros.
|
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
◆ 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 |
◆ 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().
◆ 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.
◆ 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.
◆ 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. |
◆ 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. |
◆ 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. |
◆ 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.
◆ 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
◆ 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 |
|
getprivate |
Get a value indicating wether an entry is open, requiring more data to be written.
◆ IsStreamOwner
| bool ICSharpCode.SharpZipLib.Tar.TarOutputStream.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.TarOutputStream.Length |
|
get |
length of stream in bytes
◆ Position
| override long ICSharpCode.SharpZipLib.Tar.TarOutputStream.Position |
|
getset |
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: