Package com.twelvemonkeys.io
Class RandomAccessStream
- java.lang.Object
-
- com.twelvemonkeys.io.RandomAccessStream
-
- All Implemented Interfaces:
Seekable,java.io.DataInput,java.io.DataOutput
public abstract class RandomAccessStream extends java.lang.Object implements Seekable, java.io.DataInput, java.io.DataOutput
A data stream that is both readable and writable, much like aRandomAccessFile, except it may be backed by something other than a file.- Version:
- $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/io/RandomAccessStream.java#3 $
- See Also:
RandomAccessFile
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classRandomAccessStream.InputStreamView(package private) static classRandomAccessStream.OutputStreamView
-
Field Summary
Fields Modifier and Type Field Description (package private) SeekableInputStreaminputViewThis random access stream, wrapped in anInputStream(package private) SeekableOutputStreamoutputViewThis random access stream, wrapped in anOutputStream
-
Constructor Summary
Constructors Constructor Description RandomAccessStream()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SeekableInputStreamasInputStream()Returns an input view of thisRandomAccessStream.SeekableOutputStreamasOutputStream()Returns an output view of thisRandomAccessStream.intread()intread(byte[] pBytes)intread(byte[] pBytes, int pOffset, int pLength)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.io.DataInput
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
-
Methods inherited from interface java.io.DataOutput
write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
Methods inherited from interface com.twelvemonkeys.io.Seekable
close, flush, flushBefore, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, mark, reset, seek
-
-
-
-
Field Detail
-
inputView
SeekableInputStream inputView
This random access stream, wrapped in anInputStream
-
outputView
SeekableOutputStream outputView
This random access stream, wrapped in anOutputStream
-
-
Method Detail
-
read
public int read() throws java.io.IOException- Throws:
java.io.IOException
-
read
public int read(byte[] pBytes, int pOffset, int pLength) throws java.io.IOException- Throws:
java.io.IOException
-
read
public final int read(byte[] pBytes) throws java.io.IOException- Throws:
java.io.IOException
-
asInputStream
public final SeekableInputStream asInputStream()
Returns an input view of thisRandomAccessStream. Invoking this method several times, will return the same object.Note that read access is NOT synchronized.
- Returns:
- a
SeekableInputStreamreading from this stream
-
asOutputStream
public final SeekableOutputStream asOutputStream()
Returns an output view of thisRandomAccessStream. Invoking this method several times, will return the same object.Note that write access is NOT synchronized.
- Returns:
- a
SeekableOutputStreamwriting to this stream
-
-