public class SplitStreamContainer extends StreamContainer
Represents split stream container which contains the stream and provides stream processing routines.
READ_WRITE_BYTES_COUNT
Constructor and Description |
---|
SplitStreamContainer(InputStream stream)
Initializes a new instance of the
SplitStreamContainer class. |
SplitStreamContainer(InputStream stream,
boolean disposeStream)
Initializes a new instance of the
SplitStreamContainer class. |
SplitStreamContainer(StreamContainer stream,
boolean disposeStream)
Initializes a new instance of the
SplitStreamContainer class. |
Modifier and Type | Method and Description |
---|---|
boolean |
canRead()
Gets a value indicating whether stream supports reading.
|
boolean |
canSeek()
Gets a value indicating whether stream supports seeking.
|
boolean |
canWrite()
Gets a value indicating whether stream supports writing.
|
void |
flush()
Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
|
long |
getLength()
Gets the stream length in bytes.
|
long |
getPosition()
Gets the current position within the stream.
|
Object |
getSyncRoot()
Gets an object that can be used to synchronize access to the synchronized resource.
|
void |
insert(int position,
StreamContainer stream,
boolean disposeStream)
Inserts the stream container into specified position.
|
int |
read(byte[] bytes)
Reads bytes to fill the specified bytes buffer.
|
int |
read(byte[] buffer,
int offset,
int count)
Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
|
int |
readByte()
Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
|
long |
seek(long offset,
int origin)
Sets the position within the current stream.
|
void |
seekBegin()
Sets the stream position to the beginning of the stream.
|
void |
setLength(long value)
Sets the stream length in bytes.
|
void |
setPosition(long value)
Sets the current position within the stream.
|
byte[] |
toBytes()
Converts the stream data to the
byte array. |
byte[] |
toBytes(long position,
long bytesCount)
Converts the stream data to the
byte array. |
void |
write(byte[] bytes)
Writes all of the specified bytes to the stream.
|
void |
write(byte[] buffer,
int offset,
int count)
Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
|
void |
writeByte(byte value)
Writes a byte to the current position in the stream and advances the position within the stream by one byte.
|
getStream, isStreamDisposedOnClose, save, save, save, save, save, save, to_Stream, writeTo, writeTo
close, dispose, getDisposed
public SplitStreamContainer(InputStream stream)
Initializes a new instance of the SplitStreamContainer
class.
stream
- The stream.public SplitStreamContainer(InputStream stream, boolean disposeStream)
Initializes a new instance of the SplitStreamContainer
class.
stream
- The data stream.disposeStream
- if set to true
the stream will be disposed when container is disposed.public SplitStreamContainer(StreamContainer stream, boolean disposeStream)
Initializes a new instance of the SplitStreamContainer
class.
stream
- The stream container.disposeStream
- if set to true
disposes stream.public Object getSyncRoot()
Gets an object that can be used to synchronize access to the synchronized resource.
getSyncRoot
in interface com.aspose.imaging_internal.interfaces.ISynchronizable
getSyncRoot
in class StreamContainer
public long getPosition()
Gets the current position within the stream. This value represents offset from the starting stream position passed in the StreamContainer constructor.
getPosition
in class StreamContainer
public void setPosition(long value)
Sets the current position within the stream. This value represents offset from the starting stream position passed in the StreamContainer constructor.
setPosition
in class StreamContainer
value
- The current stream position.public long getLength()
Gets the stream length in bytes. This value is less than the System.IO.Stream.Length
by the starting stream position passed in the StreamContainer constructor.
getLength
in class StreamContainer
public void setLength(long value)
Sets the stream length in bytes. This value is less than the System.IO.Stream.Length
by the starting stream position passed in the StreamContainer constructor.
setLength
in class StreamContainer
value
- The stream length.public boolean canRead()
Gets a value indicating whether stream supports reading.
canRead
in class StreamContainer
true
if stream supports reading; otherwise, false
.public boolean canSeek()
Gets a value indicating whether stream supports seeking.
canSeek
in class StreamContainer
true
if stream supports seeking; otherwise, false
.public boolean canWrite()
Gets a value indicating whether stream supports writing.
canWrite
in class StreamContainer
true
if stream supports writing; otherwise, false
.public void insert(int position, StreamContainer stream, boolean disposeStream)
Inserts the stream container into specified position.
position
- The position to insert to.stream
- The stream container to insert.disposeStream
- if set to true
disposes stream.public void flush()
Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
flush
in class StreamContainer
public void write(byte[] bytes)
Writes all of the specified bytes to the stream.
write
in class StreamContainer
bytes
- The bytes to write.public void writeByte(byte value)
Writes a byte to the current position in the stream and advances the position within the stream by one byte.
writeByte
in class StreamContainer
value
- The byte to write to the stream.public int read(byte[] bytes)
Reads bytes to fill the specified bytes buffer.
read
in class StreamContainer
bytes
- The bytes to fill.public byte[] toBytes()
Converts the stream data to the byte
array.
toBytes
in class StreamContainer
byte
array.public byte[] toBytes(long position, long bytesCount)
Converts the stream data to the byte
array.
toBytes
in class StreamContainer
position
- The position to start reading bytes from.bytesCount
- The bytes count to read.byte
array.public int read(byte[] buffer, int offset, int count)
Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
read
in class StreamContainer
buffer
- An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset
and (offset
+ count
- 1) replaced by the bytes read from the current source.offset
- The zero-based byte offset in buffer
at which to begin storing the data read from the current stream.count
- The maximum number of bytes to be read from the current stream.public int readByte()
Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
readByte
in class StreamContainer
public long seek(long offset, int origin)
Sets the position within the current stream.
seek
in class StreamContainer
offset
- A byte offset relative to the origin
parameter. This value represents offset from the starting stream position passed in the StreamContainer constructor.origin
- A value of type System.IO.SeekOrigin
indicating the reference point used to obtain the new position.public void seekBegin()
Sets the stream position to the beginning of the stream. This value represents offset from the starting stream position passed in the StreamContainer constructor.
seekBegin
in class StreamContainer
public void write(byte[] buffer, int offset, int count)
Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
write
in class StreamContainer
buffer
- An array of bytes. This method copies count
bytes from buffer
to the current stream.offset
- The zero-based byte offset in buffer
at which to begin copying bytes to the current stream.count
- The number of bytes to be written to the current stream.