public class XFileInputStream
extends java.io.InputStream
XFile
.Constructor and Description |
---|
XFileInputStream(java.lang.String name)
Creates an input file stream to read from a file with the
specified name.
|
XFileInputStream(XFile xfile)
Creates an input file stream to read from the specified
XFile object. |
Modifier and Type | Method and Description |
---|---|
int |
available()
Returns the number of bytes yet to be read from this file.
|
void |
close()
Closes this file input stream and releases any system resources
associated with the stream.
|
int |
read()
Reads a byte of data from this XFile.
|
int |
read(byte[] b)
Reads up to
b.length bytes of data from this file
into an array of bytes. |
int |
read(byte[] b,
int off,
int len)
Reads up to
len bytes of data from this file
into an array of bytes. |
long |
skip(long n)
Skips over and discards
n bytes of data from the
file. |
public XFileInputStream(XFile xfile) throws java.io.IOException
XFile
object.xfile
- the file to be opened for reading.java.io.FileNotFoundException
- if the file is
not found.java.io.IOException
public XFileInputStream(java.lang.String name) throws java.io.IOException
name
- the system-dependent file name.java.io.FileNotFoundException
- if the file is
not found.java.io.IOException
public int read() throws java.io.IOException
read
in class java.io.InputStream
-1
if the end of the file is reached.java.io.IOException
- if an I/O error occurs.public int read(byte[] b) throws java.io.IOException
b.length
bytes of data from this file
into an array of bytes.read
in class java.io.InputStream
b
- the buffer into which the data is read.-1
if there is no more data because
the end of the file has been reached.java.io.IOException
- if an I/O error occurs.public int read(byte[] b, int off, int len) throws java.io.IOException
len
bytes of data from this file
into an array of bytes.read
in class java.io.InputStream
b
- the buffer into which the data is read.off
- the start offset of the data.len
- the maximum number of bytes read.-1
if there is no more data because
the end of the file has been reached.java.io.IOException
- if an I/O error occurs.public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
- if an I/O error occurs.public long skip(long n) throws java.io.IOException
n
bytes of data from the
file.
The skip
method may, for a variety of
reasons, end up skipping over some smaller number of bytes,
possibly 0
.
The actual number of bytes skipped is returned.skip
in class java.io.InputStream
n
- the number of bytes to be skipped.java.io.IOException
- if an I/O error occurs.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
- if an I/O error occurs.