phelps.io
public class ByteArrayRAF extends Object implements RandomAccess
byte[]
,
in the same way java.io.ByteArrayInputStream provides an InputStream interface.
Useful to make java.io.File-like objects from in-memory data, as within an applet or Java Web Start sandbox.
Does not subclass java.io.RandomAccessFile because we want to use this class in restricted situations where reading of local files is not permitted, and java.io.RandomAccessFile always checks the readability of its file.
Version: $Revision$ $Date$
See Also: BufferedRandomAccessFile
Constructor Summary | |
---|---|
ByteArrayRAF(byte[] buf, String mode) | |
ByteArrayRAF(InputStream in, String mode)
Sets contents from (remainder of) in and closes in. |
Method Summary | |
---|---|
void | close() |
long | getFilePointer() |
long | length() |
int | read(byte[] b) |
int | read(byte[] b, int off, int len) |
int | read() |
void | readFully(byte[] b) |
void | readFully(byte[] b, int off, int len) |
void | seek(long pos) |
void | setLength(long newLength) |
int | skipBytes(int n) |
byte[] | toByteArray() |
void | write(byte[] b) |
void | write(byte[] b, int off, int len) |
void | write(int b) |
void | writeChar(char ch) |
void | writeString16(String s) |
void | writeString8(String s) |
Parameters: mode can be any mode accepted by java.io.RandomAccessFile: "r"
, "rw"
, "rws"
, "rwd"
.