|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
org.albite.io.RandomReadingFile
public class RandomReadingFile
Implements random reading from a
FileConnection
The essential methods are seek(int position)
and getPointer()
.
This class also re-implements all the methods from
InputStream
All other methods are only wrappings around
the underlying DataInputStream
or FileConnection
Constructor Summary | |
---|---|
RandomReadingFile(java.lang.String url)
Creates a new RandomReadingFile from a valid file URL. |
Method Summary | |
---|---|
void |
close()
Closes the file and the underlying FileConnection |
java.lang.String |
getName()
|
java.lang.String |
getPath()
|
int |
getPointer()
Returns the current position of the reading pointer in the file |
java.lang.String |
getURL()
|
int |
length()
|
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b,
int off,
int len)
|
boolean |
readBoolean()
|
byte |
readByte()
|
char |
readChar()
|
double |
readDouble()
|
float |
readFloat()
|
void |
readFully(byte[] b)
|
void |
readFully(byte[] b,
int off,
int len)
|
int |
readInt()
|
long |
readLong()
|
short |
readShort()
|
int |
readUnsignedByte()
|
int |
readUnsignedShort()
|
java.lang.String |
readUTF()
|
void |
seek(int position)
Seeks to the specified position |
long |
skip(long n)
|
int |
skipBytes(int n)
|
Methods inherited from class java.io.InputStream |
---|
available, mark, markSupported, reset |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomReadingFile(java.lang.String url) throws java.io.IOException
url
- The URL of the file that is being opened.
java.io.IOException
Method Detail |
---|
public final int length() throws java.io.IOException
javax.microedition.io.file.ConnectionClosedException
- if the file is closed.
java.lang.SecurityException
- if the security of the
application does not have read
access for the file
java.io.IOException
public final java.lang.String getName()
public final java.lang.String getURL()
public final java.lang.String getPath()
public final void seek(int position) throws java.io.IOException
position
-
java.lang.IllegalArgumentException
- if the position
argument
is wrong, i.e.:
position < 0
or
length()
<= position
java.io.IOException
- if an IOException occurredpublic final long skip(long n) throws java.io.IOException
skip
in class java.io.InputStream
java.io.IOException
public final int skipBytes(int n) throws java.io.IOException
skipBytes
in interface java.io.DataInput
java.io.IOException
public final boolean readBoolean() throws java.io.IOException
readBoolean
in interface java.io.DataInput
java.io.IOException
public final byte readByte() throws java.io.IOException
readByte
in interface java.io.DataInput
java.io.IOException
public final char readChar() throws java.io.IOException
readChar
in interface java.io.DataInput
java.io.IOException
public final double readDouble() throws java.io.IOException
readDouble
in interface java.io.DataInput
java.io.IOException
public final float readFloat() throws java.io.IOException
readFloat
in interface java.io.DataInput
java.io.IOException
public final int readInt() throws java.io.IOException
readInt
in interface java.io.DataInput
java.io.IOException
public final int readUnsignedByte() throws java.io.IOException
readUnsignedByte
in interface java.io.DataInput
java.io.IOException
public final int readUnsignedShort() throws java.io.IOException
readUnsignedShort
in interface java.io.DataInput
java.io.IOException
public final java.lang.String readUTF() throws java.io.IOException
readUTF
in interface java.io.DataInput
java.io.IOException
public final long readLong() throws java.io.IOException
readLong
in interface java.io.DataInput
java.io.IOException
public final short readShort() throws java.io.IOException
readShort
in interface java.io.DataInput
java.io.IOException
public final int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public final int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public final int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public final void readFully(byte[] b) throws java.io.IOException
readFully
in interface java.io.DataInput
java.io.IOException
public final void readFully(byte[] b, int off, int len) throws java.io.IOException
readFully
in interface java.io.DataInput
java.io.IOException
public final void close() throws java.io.IOException
FileConnection
close
in interface javax.microedition.io.Connection
close
in class java.io.InputStream
java.io.IOException
public final int getPointer()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |