java.lang.AutoCloseableFileStream, MemoryStreampublic interface Stream
extends java.lang.AutoCloseable
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Close the stream and release all associated resources.
|
long |
getLength() |
Get the length of the stream in bytes
|
int |
read(byte[] buffer,
int offset,
int length) |
Read from the stream
|
boolean |
seek(long position) |
Set byte position
|
long |
tell() |
Get current byte position
|
void |
write(byte[] buffer,
int offset,
int length) |
Write to the stream
|
long getLength()
throws java.io.IOException
java.io.IOExceptionboolean seek(long position)
throws java.io.IOException
position - The new position of the stream (-1 for EOS)java.io.IOExceptionlong tell() throws java.io.IOException
java.io.IOExceptionint read(byte[] buffer,
int offset,
int length)
throws java.io.IOException
buffer - The buffer where the data is writtenoffset - The starting element in the bufferlength - The maximum number of bytes to be readjava.io.IOExceptionvoid write(byte[] buffer,
int offset,
int length)
throws java.io.IOException
buffer - The buffer where the data liesoffset - The starting element in the bufferlength - The maximum number of bytes to writejava.io.IOExceptionvoid close()
throws java.io.IOException
close in interface java.lang.AutoCloseablejava.io.IOException