public class FilePtr
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
useragent |
| Constructor and Description |
|---|
FilePtr(java.io.RandomAccessFile fp,
java.net.Socket sk,
java.io.InputStream is,
java.io.BufferedOutputStream os,
java.lang.String fnamp,
long fileLength,
int bufsize)
Creates a new FilePtr instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the connection to the file.
|
long |
getFilePointer()
Returns the current position of the file pointer.
|
long |
length()
Returns the length of the file.
|
byte |
readByte()
Reads one (signed) byte.
|
double |
readDouble()
Reads a double value.
|
int |
readInt()
Reads a (signed) integer value.
|
java.lang.String |
readLine()
Reads a complete line from the file.
|
short |
readShort()
Reads a (signed) short value.
|
int |
readUnsignedByte()
Reads one unsigned byte.
|
void |
seek(long pos)
Positions the file pointer.
|
void |
setBigendian(boolean bigendian) |
public static final java.lang.String useragent
public FilePtr(java.io.RandomAccessFile fp,
java.net.Socket sk,
java.io.InputStream is,
java.io.BufferedOutputStream os,
java.lang.String fnamp,
long fileLength,
int bufsize)
throws java.io.IOException
fp - (optional) RandomAccessFile, if already open and availablesk - (optional) Socket, if already open and availableis - (optional) InputStream, if already openedos - (optional) The OutputStream to write to for HTTP-accessfnamp - (optional) The url for HTTP-accessfileLength - (optional) The file length of an opened data filebufsize - Size of input-buffer to be usedjava.io.IOExceptionpublic void setBigendian(boolean bigendian)
public byte readByte()
throws java.io.IOException,
java.io.EOFException
java.io.IOException - if an I/O error occurs.java.io.EOFException - if the end of file is reached before the
byte could be read.public int readUnsignedByte()
throws java.io.IOException,
java.io.EOFException
java.io.IOException - if an I/O error occurs.java.io.EOFException - if the end of file is reached before the
byte could be read.public short readShort()
throws java.io.IOException,
java.io.EOFException
java.io.IOException - if an I/O error occurs.java.io.EOFException - if the end of file is reached before the
2 bytes could be read completely.public int readInt()
throws java.io.IOException,
java.io.EOFException
java.io.IOException - if an I/O error occurs.java.io.EOFException - if the end of file is reached before the
4 bytes could be read completely.public double readDouble()
throws java.io.IOException,
java.io.EOFException
java.io.IOException - if an I/O error occurs.java.io.EOFException - if the end of file is reached before the
8 bytes could be read completely.public java.lang.String readLine()
throws java.io.IOException,
java.io.EOFException
java.io.IOException - if an I/O error occurs.java.io.EOFException - if the end of file is reached before even one
character (byte) could be read.public void close()
throws java.io.IOException
java.io.IOException - if an I/O error occurs.public long getFilePointer()
public long length()
throws java.io.IOException
java.io.IOException - if an I/O error occurs.public void seek(long pos)
pos - the new position in the file. The position is seen zero based.