use of org.commonjava.maven.galley.util.TransferInputStream in project galley by Commonjava.
the class Transfer method openInputStream.
public InputStream openInputStream(final boolean fireEvents, final EventMetadata eventMetadata) throws IOException {
provider.waitForReadUnlock(resource);
try {
InputStream stream = provider.openInputStream(resource);
if (stream == null) {
return null;
}
if (fireEvents) {
stream = new TransferInputStream(stream, new FileAccessEvent(this, eventMetadata), fileEventManager);
}
stream = decorator == null ? stream : decorator.decorateRead(stream, this, eventMetadata);
logger.trace("Returning stream: {} for transfer: {}", stream.getClass().getName(), this);
return stream;
} catch (final IOException e) {
if (fireEvents) {
fileEventManager.fire(new FileErrorEvent(this, e, eventMetadata));
}
throw e;
}
}
Aggregations