ewe.io
Interface FastStream
- All Known Implementing Classes:
- MemoryFile, RandomAccessFile
- public interface FastStream
|
Method Summary |
int |
quickRead(byte[] data,
int offset,
int length,
boolean readAll)
This attempts to read using a fast native or direct method. |
void |
quickWrite(byte[] data,
int offset,
int length)
This attempts to write using a fast native or direct access method. |
quickRead
public int quickRead(byte[] data,
int offset,
int length,
boolean readAll)
throws IOException
- This attempts to read using a fast native or direct method. Failing that a normal read is done. If a
native method is used the method will block the entire VM until the data is read,
so you should use this with care.
- Parameters:
data - The destination for the data.offset - The index in the destination for the data.length - The number of bytes to read.readAll - if this is true then the method will not return until a full length number of
bytes have been read. If the stream ends before this then an IOException is thrown.
- Returns:
- the number of bytes read or -1 if the stream ended with no bytes read.
- Throws:
IOException
quickWrite
public void quickWrite(byte[] data,
int offset,
int length)
throws IOException
- This attempts to write using a fast native or direct access method. Failing that a normal write is done. If the
native method is used the method will block the entire VM until the data is written,
so you should use this with care.
- Parameters:
data - The source of the data bytes.offset - The index in the source of the data.length - The number of bytes to write.
- Throws:
IOException