|
|||||||||
| 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 FileSeekableStream

java.lang.Objectjava.io.InputStream
org.ydp.jai.SeekableStream
org.ydp.jai.FileSeekableStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.DataInput
- public class FileSeekableStream
- extends SeekableStream
A subclass of SeekableStream that takes its input
from a File or RandomAccessFile.
Backwards seeking 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[] |
currentPage
|
private java.io.RandomAccessFile |
file
|
private long |
length
|
private long |
markPos
|
private static int |
NUM_PAGES
|
private static int |
PAGE_MASK
|
private static int |
PAGE_SHIFT
|
private static int |
PAGE_SIZE
|
private byte[][] |
pageBuf
|
private long |
pointer
|
private static int |
READ_CACHE_LIMIT
|
| Fields inherited from class org.ydp.jai.SeekableStream |
|
| Constructor Summary | |
FileSeekableStream(java.io.File file)
Constructs a FileSeekableStream from a
File. |
|
FileSeekableStream(java.io.RandomAccessFile file)
Constructs a FileSeekableStream from a
RandomAccessFile. |
|
FileSeekableStream(java.lang.String name)
Constructs a FileSeekableStream from a
String path name. |
|
| Method Summary | |
boolean |
canSeekBackwards()
Returns true since seeking backwards is supported. |
void |
close()
Forwards the request to the real File. |
long |
getFilePointer()
Returns the current offset in this stream. |
void |
mark(int readLimit)
Marks the current file position for later return using the reset() method. |
boolean |
markSupported()
Returns true since marking is supported. |
int |
read()
Forwards the request to the real File. |
int |
read(byte[] b,
int off,
int len)
Forwards the request to the real File. |
private byte[] |
readPage(long pointer)
|
void |
reset()
Returns the file position to its position at the time of the immediately previous call to the mark()
method. |
void |
seek(long pos)
Sets the offset, measured from the beginning of this stream, at which the next read occurs. |
int |
skip(int n)
|
| Methods inherited from class org.ydp.jai.SeekableStream |
finalize, readBoolean, readByte, readChar, readCharLE, readDouble, readDoubleLE, readFloat, readFloatLE, readFully, readFully, readInt, readIntLE, readLine, readLong, readLongLE, readShort, readShortLE, readUnsignedByte, readUnsignedInt, readUnsignedIntLE, readUnsignedShort, readUnsignedShortLE, readUTF, skipBytes, 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 |
file
private java.io.RandomAccessFile file
markPos
private long markPos
PAGE_SHIFT
private static final int PAGE_SHIFT
- See Also:
- Constant Field Values
PAGE_SIZE
private static final int PAGE_SIZE
- See Also:
- Constant Field Values
PAGE_MASK
private static final int PAGE_MASK
- See Also:
- Constant Field Values
NUM_PAGES
private static final int NUM_PAGES
- See Also:
- Constant Field Values
READ_CACHE_LIMIT
private static final int READ_CACHE_LIMIT
- See Also:
- Constant Field Values
pageBuf
private byte[][] pageBuf
currentPage
private int[] currentPage
length
private long length
pointer
private long pointer
| Constructor Detail |
FileSeekableStream
public FileSeekableStream(java.io.RandomAccessFile file) throws java.io.IOException
- Constructs a
FileSeekableStreamfrom aRandomAccessFile.
FileSeekableStream
public FileSeekableStream(java.io.File file) throws java.io.IOException
- Constructs a
FileSeekableStreamfrom aFile.
FileSeekableStream
public FileSeekableStream(java.lang.String name) throws java.io.IOException
- Constructs a
FileSeekableStreamfrom aStringpath name.
| Method Detail |
canSeekBackwards
public final boolean canSeekBackwards()
- Returns true since seeking backwards is supported.
- Overrides:
canSeekBackwardsin classSeekableStream
getFilePointer
public final long getFilePointer()
throws java.io.IOException
- Returns the current offset in this stream.
- Specified by:
getFilePointerin classSeekableStream
seek
public final void seek(long pos)
throws java.io.IOException
- Description copied from class:
SeekableStream - Sets the offset, measured from the beginning of this
stream, at which the next read occurs.
If
canSeekBackwards()returnsfalse, then settingposto an offset smaller than the current value ofgetFilePointer()will have no effect.- Specified by:
seekin classSeekableStream
skip
public final int skip(int n)
throws java.io.IOException
readPage
private byte[] readPage(long pointer)
throws java.io.IOException
read
public final int read()
throws java.io.IOException
- Forwards the request to the real
File.- Specified by:
readin classSeekableStream
read
public final int read(byte[] b,
int off,
int len)
throws java.io.IOException
- Forwards the request to the real
File.- Specified by:
readin classSeekableStream
close
public final void close()
throws java.io.IOException
- Forwards the request to the real
File.
mark
public final void mark(int readLimit)
- Marks the current file position for later return using
the
reset()method.- Overrides:
markin classSeekableStream
reset
public final void reset()
throws java.io.IOException
- Returns the file position to its position at the time of
the immediately previous call to the
mark()method.- Overrides:
resetin classSeekableStream
markSupported
public boolean markSupported()
- Returns
truesince marking is supported.- Overrides:
markSupportedin classSeekableStream
|
|||||||||
| Home >> All >> org >> ydp >> [ jai overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC