java.lang.AutoCloseable
public interface CacheStream
extends java.lang.AutoCloseable
Modifier and Type | Method | Description |
---|---|---|
boolean |
canRead() |
Gets a value indicating whether the current stream supports reading.
|
boolean |
canSeek() |
Gets a value indicating whether the current stream supports seeking.
|
boolean |
canWrite() |
Gets a value indicating whether the current stream supports writing.
|
boolean |
closed() |
Gets a value indicating whether stream is closed or not.
|
void |
flush() |
When overridden in a derived class, clears all buffers for this stream and causes any
buffered data to be written to the underlying device.
|
java.io.BufferedInputStream |
getBufferedInputStream() |
Gets the
BufferedInputStream instance. |
java.io.BufferedInputStream |
getBufferedInputStream(int bufferSize) |
Gets the
BufferedInputStream of given buffer size. |
java.io.BufferedOutputStream |
getBufferedOutputStream() |
Gets the
BufferedOutputStream of given buffer size. |
java.io.BufferedOutputStream |
getBufferedOutputStream(int bufferSize) |
Gets the
BufferedOutputStream of given buffer size. |
long |
length() |
Gets the length of the stream.
|
long |
position() |
Gets the position within current stream.
|
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.
|
long |
seek(long offset) |
Sets the position within the current stream.
|
void |
setLength(long value) |
Sets the length of 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.
|
long length() throws java.lang.Exception
java.lang.Exception
boolean canRead()
boolean canSeek()
boolean canWrite()
boolean closed()
void flush()
long position() throws java.lang.Exception
java.lang.Exception
long seek(long offset) throws NotSupportedException
offset
- A byte offset relative to the origin parameter.NotSupportedException
- If stream does not support seeking.void setLength(long value) throws NotSupportedException
value
- The desired length of the current stream in bytes.NotSupportedException
- If stream does not support both writing and seeking.java.io.BufferedInputStream getBufferedInputStream(int bufferSize) throws java.lang.Exception
BufferedInputStream
of given buffer size.bufferSize
- Buffer size in bytes.java.lang.Exception
java.io.BufferedInputStream getBufferedInputStream() throws java.lang.Exception
BufferedInputStream
instance.java.lang.Exception
java.io.BufferedOutputStream getBufferedOutputStream(int bufferSize) throws java.lang.Exception
BufferedOutputStream
of given buffer size.bufferSize
- Buffer size in bytes.java.lang.Exception
java.io.BufferedOutputStream getBufferedOutputStream() throws java.lang.Exception
BufferedOutputStream
of given buffer size.java.lang.Exception
int read(byte[] buffer, int offset, int count) throws java.lang.Exception
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.java.lang.Exception
void write(byte[] buffer, int offset, int count) throws java.lang.Exception
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.java.lang.Exception