|
|||||||||
| Home >> All >> org >> ydp >> [ jai overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.ydp.jai
Class ByteArraySeekableStream

java.lang.Objectjava.io.InputStream
org.ydp.jai.SeekableStream
org.ydp.jai.ByteArraySeekableStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.DataInput
- public class ByteArraySeekableStream
- extends SeekableStream
A subclass of SeekableStream that takes input from an
array of bytes. Seeking backwards is supported. The
mark() and resest() methods are
supported.
This class is not a committed part of the JAI API. It may be removed or changed in future releases of JAI.
| Field Summary | |
private int |
length
The length of the valid segment of the array. |
private int |
offset
The starting offset within the array. |
private int |
pointer
The current output position. |
private byte[] |
src
Array holding the source data. |
| Fields inherited from class org.ydp.jai.SeekableStream |
markPos |
| Constructor Summary | |
ByteArraySeekableStream(byte[] src)
Constructs a ByteArraySeekableStream taking
input from an entire input byte array. |
|
ByteArraySeekableStream(byte[] src,
int offset,
int length)
Constructs a ByteArraySeekableStream taking
input from a given segment of an input byte array. |
|
| Method Summary | |
boolean |
canSeekBackwards()
Returns true since this object supports seeking
backwards. |
void |
close()
Does nothing. |
long |
getFilePointer()
Returns the current offset in this stream. |
long |
length()
Returns the number of valid bytes in the input array. |
int |
read()
Reads the next byte of data from the input array. |
int |
read(byte[] b,
int off,
int len)
Copies up to len bytes of data from the input array into
an array of bytes. |
void |
seek(long pos)
Sets the offset, measured from the beginning of this stream, at which the next read occurs. |
int |
skipBytes(int n)
Attempts to skip over n bytes of input discarding the
skipped bytes. |
| Methods inherited from class org.ydp.jai.SeekableStream |
finalize, mark, markSupported, readBoolean, readByte, readChar, readCharLE, readDouble, readDoubleLE, readFloat, readFloatLE, readFully, readFully, readInt, readIntLE, readLine, readLong, readLongLE, readShort, readShortLE, readUnsignedByte, readUnsignedInt, readUnsignedIntLE, readUnsignedShort, readUnsignedShortLE, readUTF, reset, wrapInputStream |
| Methods inherited from class java.io.InputStream |
available, read, skip |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
src
private byte[] src
- Array holding the source data.
offset
private int offset
- The starting offset within the array.
length
private int length
- The length of the valid segment of the array.
pointer
private int pointer
- The current output position.
| Constructor Detail |
ByteArraySeekableStream
public ByteArraySeekableStream(byte[] src,
int offset,
int length)
throws java.io.IOException
- Constructs a
ByteArraySeekableStreamtaking input from a given segment of an inputbytearray.
ByteArraySeekableStream
public ByteArraySeekableStream(byte[] src)
throws java.io.IOException
- Constructs a
ByteArraySeekableStreamtaking input from an entire inputbytearray.
| Method Detail |
canSeekBackwards
public boolean canSeekBackwards()
- Returns
truesince this object supports seeking backwards.- Overrides:
canSeekBackwardsin classSeekableStream
getFilePointer
public long getFilePointer()
- Returns the current offset in this stream.
- Specified by:
getFilePointerin classSeekableStream
seek
public void seek(long pos)
- Sets the offset, measured from the beginning of this
stream, at which the next read occurs. Seeking backwards is
allowed.
- Specified by:
seekin classSeekableStream
read
public int read()
- Reads the next byte of data from the input array. The value byte is
returned as an
intin the range0to255. If no byte is available because the end of the stream has been reached, the value-1is returned.- Specified by:
readin classSeekableStream
read
public int read(byte[] b,
int off,
int len)
- Copies up to
lenbytes of data from the input array into an array of bytes. An attempt is made to copy as many aslenbytes, but a smaller number may be copied, possibly zero. The number of bytes actually copied is returned as an integer.If
bisnull, aNullPointerExceptionis thrown.If
offis negative, orlenis negative, oroff+lenis greater than the length of the arrayb, then anIndexOutOfBoundsExceptionis thrown.If
lenis zero, then no bytes are copied and0is returned; otherwise, there is an attempt to copy at least one byte. If no byte is available because the stream is at end of stream, the value-1is returned; otherwise, at least one byte is copied intob.The first byte copied is stored into element
b[off], the next one intob[off+1], and so on. The number of bytes copied is, at most, equal tolen. Let k be the number of bytes actually copied; these bytes will be stored in elementsb[off]throughb[off+k-1], leaving elementsb[off+k]throughb[off+len-1]unaffected.In every case, elements
b[0]throughb[off]and elementsb[off+len]throughb[b.length-1]are unaffected.- Specified by:
readin classSeekableStream
skipBytes
public int skipBytes(int n)
- Attempts to skip over
nbytes of input discarding the skipped bytes.This method may skip over some smaller number of bytes, possibly zero. This may result from any of a number of conditions; reaching end of stream before
nbytes have been skipped is only one possibility. This method never throws anEOFException. The actual number of bytes skipped is returned. Ifnis negative, no bytes are skipped.- Specified by:
skipBytesin interfacejava.io.DataInput- Overrides:
skipBytesin classSeekableStream
close
public void close()
- Does nothing.
length
public long length()
- Returns the number of valid bytes in the input array.
|
|||||||||
| Home >> All >> org >> ydp >> [ jai overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC