public class FileSeekableInputStream extends java.lang.Object implements SeekableInputStream
Constructor and Description |
---|
FileSeekableInputStream(java.io.File file)
Deprecated.
Creates a FileSeekableInputStream object that reads from a file.
|
FileSeekableInputStream(java.lang.String fileName)
Deprecated.
Creates a FileSeekableInputStream object that reads from a named file.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Deprecated.
Closes the input stream and releases any resources associated with this stream.
|
long |
getFilePointer()
Deprecated.
Returns the current offset in this stream.
|
int |
read()
Deprecated.
Reads a single byte from the stream.
|
int |
read(byte[] b)
Deprecated.
Reads data from the stream into the specified byte array, up to the length of the specified byte array. If the stream has fewer bytes than the length of the specified byte array, this method reads the actual number of bytes in the stream.
|
int |
read(byte[] b, int off, int len)
Deprecated.
Reads up to the specified number of bytes from the stream into the specified byte array starting at the starting position for the offset.
|
void |
seek(long pos)
Deprecated.
Sets the file-pointer offset, measured from the beginning of the stream, at which the next read operation will occur. The offset may be set beyond the end of the stream. Setting the offset beyond the end of the stream does not change the stream length; the stream length will change only by writing after the offset has been set beyond the end of the stream.
|
long |
skip(long n)
Deprecated.
Attempts to skip over the specified number of bytes of input.
This method may skip over some smaller number of bytes, possibly zero. This action may result from a number of conditions. For example, reaching the end of the stream before the specified number of bytes have been skipped. This method never throws an end-of-file exception. |
public FileSeekableInputStream(java.io.File file) throws java.io.IOException, java.io.FileNotFoundException
file
- the file from which the data will be read.java.io.FileNotFoundException
- if the file does not exist.java.io.IOException
- if an IO error occurs or if the value of the file parameter is null
.public FileSeekableInputStream(java.lang.String fileName) throws java.io.IOException, java.io.FileNotFoundException
fileName
- the name of the system-dependent file.java.io.FileNotFoundException
- if the file does not exist.java.io.IOException
- if an IO error occurs or if the value of the name parameter is null
.public long getFilePointer() throws java.lang.Exception
SeekableInputStream
getFilePointer
in interface SeekableInputStream
java.lang.Exception
- if an IO error occurs.public void seek(long pos) throws java.lang.Exception
seek
in interface SeekableInputStream
pos
- the offset position, measured in bytes from the beginning of the stream, at which to set the file pointer.java.lang.Exception
- if the value of the pos parameter is less than zero or if an IO error occurs.public int read() throws java.lang.Exception
read
in interface SeekableInputStream
int
) in the range of 0 to 255, or -1 if the end of the stream has been reached.java.lang.Exception
- if an IO error occurs.public int read(byte[] b, int off, int len) throws java.lang.Exception
read
in interface SeekableInputStream
b
- the buffer into which the data will be read.off
- the starting position for the offset in the byte array.len
- the maximum number of bytes to be read.java.lang.Exception
- if an IO error occurs.public int read(byte[] b) throws java.lang.Exception
read
in interface SeekableInputStream
b
- the buffer into which the data will be read.java.lang.Exception
- if an IO error occurs.public long skip(long n) throws java.lang.Exception
This method may skip over some smaller number of bytes, possibly zero. This action may result from a number of conditions. For example, reaching the end of the stream before the specified number of bytes have been skipped. This method never throws an end-of-file exception.
skip
in interface SeekableInputStream
n
- the number of bytes to be skipped.java.lang.Exception
- if an IO error occurs.public void close() throws java.lang.Exception
close
in interface SeekableInputStream
java.lang.Exception
- if an IO error occurs.