Package org.dict.zip
Class RandomAccessInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.dict.zip.RandomAccessInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class RandomAccessInputStream extends InputStream
RandomAccessInputStream.
-
-
Constructor Summary
Constructors Constructor Description RandomAccessInputStream(RandomAccessFile inFile)Construct RandomAccessInputStream from file.RandomAccessInputStream(String file, String mode)Construct RandomAccessInputStream from filename.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()intgetLength()Get file length.intgetPos()Get cursor position.voidmark(int markpos)booleanmarkSupported()intread()intread(byte[] buf, int off, int len)voidreadFully(byte[] buf)Read full data to byte buffer.voidreset()voidseek(long pos)Seek file position.longskip(long size)-
Methods inherited from class java.io.InputStream
nullInputStream, read, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
RandomAccessInputStream
public RandomAccessInputStream(RandomAccessFile inFile)
Construct RandomAccessInputStream from file.- Parameters:
inFile- RandomAccessFile
-
RandomAccessInputStream
public RandomAccessInputStream(String file, String mode) throws IOException
Construct RandomAccessInputStream from filename.- Parameters:
file- to read with random access.mode- open mode.- Throws:
IOException- if an I/O error has occurred.
-
-
Method Detail
-
available
public final int available() throws IOException- Overrides:
availablein classInputStream- Throws:
IOException
-
close
public final void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
getLength
public final int getLength() throws IOExceptionGet file length.- Returns:
- length of file in byte.
- Throws:
IOException- if an I/O error has occurred.
-
getPos
public final int getPos() throws IOExceptionGet cursor position.- Returns:
- position in byte.
- Throws:
IOException- if an I/O error has occurred.
-
mark
public final void mark(int markpos)
- Overrides:
markin classInputStream
-
markSupported
public final boolean markSupported()
- Overrides:
markSupportedin classInputStream
-
read
public final int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public final int read(byte[] buf, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
readFully
public final void readFully(byte[] buf) throws IOExceptionRead full data to byte buffer.- Parameters:
buf- buffer to store data.- Throws:
IOException- if an I/O error has occurred.
-
reset
public final void reset() throws IOException- Overrides:
resetin classInputStream- Throws:
IOException
-
seek
public final void seek(long pos) throws IOExceptionSeek file position.- Parameters:
pos- file position in byte.- Throws:
IOException- if an I/O error has occurred.
-
skip
public final long skip(long size) throws IOException- Overrides:
skipin classInputStream- Throws:
IOException
-
-