public class LazyFileInputStream
extends org.apache.commons.io.input.AutoCloseInputStream
Modifier and Type | Field and Description |
---|---|
protected FileDescriptor |
fd
The file descriptor to use.
|
protected File |
file
The file to read from.
|
protected boolean |
opened
True if the input stream was opened.
|
in
Constructor and Description |
---|
LazyFileInputStream(File file)
Creates a new
LazyFileInputStream for the given file. |
LazyFileInputStream(FileDescriptor fd)
Creates a new
LazyFileInputStream for the given file
descriptor. |
LazyFileInputStream(String name)
Creates a new
LazyFileInputStream for the given file. |
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
void |
mark(int readlimit) |
boolean |
markSupported() |
protected void |
open()
Open the stream if required.
|
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
long |
skip(long n) |
afterRead, builder, finalize
protected final FileDescriptor fd
protected final File file
protected boolean opened
public LazyFileInputStream(File file) throws FileNotFoundException
LazyFileInputStream
for the given file. If the
file is unreadable, a FileNotFoundException is thrown.
The file is not opened until the first byte is read from the stream.file
- the fileFileNotFoundException
public LazyFileInputStream(FileDescriptor fd)
LazyFileInputStream
for the given file
descriptor.
The file is not opened until the first byte is read from the stream.fd
- public LazyFileInputStream(String name) throws FileNotFoundException
LazyFileInputStream
for the given file. If the
file is unreadable, a FileNotFoundException is thrown.name
- FileNotFoundException
protected void open() throws IOException
IOException
public int read() throws IOException
read
in class org.apache.commons.io.input.ProxyInputStream
IOException
public int available() throws IOException
available
in class org.apache.commons.io.input.ProxyInputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class org.apache.commons.io.input.AutoCloseInputStream
IOException
public void reset() throws IOException
reset
in class org.apache.commons.io.input.ProxyInputStream
IOException
public boolean markSupported()
markSupported
in class org.apache.commons.io.input.ProxyInputStream
public void mark(int readlimit)
mark
in class org.apache.commons.io.input.ProxyInputStream
public long skip(long n) throws IOException
skip
in class org.apache.commons.io.input.ProxyInputStream
IOException
public int read(byte[] b) throws IOException
read
in class org.apache.commons.io.input.ProxyInputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class org.apache.commons.io.input.ProxyInputStream
IOException
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.