public abstract class AbstractFileInputStream
extends org.apache.commons.io.input.AutoCloseInputStream
InputStream instances returned by connectors which operate over a FileSystem.
It's an AutoCloseInputStream which also contains the concept of a PathLock which is released when the stream is
closed or fully consumed.
Because in most implementations the actual reading of the stream requires initialising/maintaining a connection, instances are
created through a LazyStreamSupplier. This allows such connection/resource to be provisioned lazily. This is very
useful in cases such as FileSystem.list(FileConnectorConfig, String, boolean, Predicate). Being able to only
lazily establish the connections, prevents the connector from opening many connections at the same time, at the risk that many
of them might end up not being necessary at the same time.
in| Constructor and Description |
|---|
AbstractFileInputStream(LazyStreamSupplier streamSupplier,
PathLock lock) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the stream and invokes
PathLock.release() on the lock. |
protected void |
doClose() |
boolean |
isLocked() |
public AbstractFileInputStream(LazyStreamSupplier streamSupplier, PathLock lock)
public final void close()
throws IOException
PathLock.release() on the lock.
Because the actual stream is lazily opened, the possibility exists for this method being invoked before the
streamSupplier is used. In such case, this method will not fail.
close in interface Closeableclose in interface AutoCloseableclose in class org.apache.commons.io.input.AutoCloseInputStreamIOException - in case of errorprotected void doClose()
throws IOException
IOExceptionpublic boolean isLocked()
Copyright © 2003–2019 MuleSoft, Inc.. All rights reserved.