public class LazyFileInputStream extends AutoCloseInputStream
AutoCloseInputStream.Builder| Constructor and Description |
|---|
LazyFileInputStream(java.io.File file)
Creates a new
LazyFileInputStream for the given file. |
LazyFileInputStream(java.io.FileDescriptor fd)
Creates a new
LazyFileInputStream for the given file
descriptor. |
LazyFileInputStream(java.lang.String name)
Creates a new
LazyFileInputStream for the given file. |
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Invokes the delegate's
InputStream.available() method. |
void |
close()
Closes the underlying input stream and replaces the reference to it with a
ClosedInputStream instance. |
void |
mark(int readlimit)
Invokes the delegate's
InputStream.mark(int) method. |
boolean |
markSupported()
Invokes the delegate's
InputStream.markSupported() method. |
int |
read()
Invokes the delegate's
InputStream.read() method unless the stream is closed. |
int |
read(byte[] b)
Invokes the delegate's
InputStream.read(byte[]) method. |
int |
read(byte[] b,
int off,
int len)
Invokes the delegate's
InputStream.read(byte[], int, int) method. |
void |
reset()
Invokes the delegate's
InputStream.reset() method. |
long |
skip(long n)
Invokes the delegate's
InputStream.skip(long) method. |
buildersetReference, unwrappublic LazyFileInputStream(java.io.File file)
throws java.io.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 filejava.io.FileNotFoundExceptionpublic LazyFileInputStream(java.io.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(java.lang.String name)
throws java.io.FileNotFoundException
LazyFileInputStream for the given file. If the
file is unreadable, a FileNotFoundException is thrown.name - java.io.FileNotFoundExceptionpublic int read()
throws java.io.IOException
ProxyInputStreamInputStream.read() method unless the stream is closed.read in class ProxyInputStreamEOF if we reached the end of stream.java.io.IOException - if an I/O error occurs.public int available()
throws java.io.IOException
ProxyInputStreamInputStream.available() method.available in class ProxyInputStreamjava.io.IOException - if an I/O error occurs.public void close()
throws java.io.IOException
AutoCloseInputStreamClosedInputStream instance.
This method is automatically called by the read methods when the end of input has been reached.
Note that it is safe to call this method any number of times. The original underlying input stream is closed and discarded only once when this method is first called.
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class AutoCloseInputStreamjava.io.IOException - if the underlying input stream cannot be closedpublic void reset()
throws java.io.IOException
ProxyInputStreamInputStream.reset() method.reset in class ProxyInputStreamjava.io.IOException - if this stream has not been marked or if the mark has been invalidated.public boolean markSupported()
ProxyInputStreamInputStream.markSupported() method.markSupported in class ProxyInputStreamtrue if this stream instance supports the mark and reset methods; false otherwise.ProxyInputStream.mark(int),
ProxyInputStream.reset()public void mark(int readlimit)
ProxyInputStreamInputStream.mark(int) method.mark in class ProxyInputStreamreadlimit - read ahead limit.public long skip(long n)
throws java.io.IOException
ProxyInputStreamInputStream.skip(long) method.skip in class ProxyInputStreamn - the number of bytes to skip.java.io.IOException - if the stream does not support seek, or if some other I/O error occurs.public int read(byte[] b)
throws java.io.IOException
ProxyInputStreamInputStream.read(byte[]) method.read in class ProxyInputStreamb - the buffer to read the bytes into.EOF if we reached the end of stream.java.io.IOException - public int read(byte[] b,
int off,
int len)
throws java.io.IOException
ProxyInputStreamInputStream.read(byte[], int, int) method.read in class ProxyInputStreamb - the buffer to read the bytes into.off - The start offset.len - The number of bytes to read.EOF if we reached the end of stream.java.io.IOException - Copyright © 2010 - 2025 Adobe. All Rights Reserved