Package org.alfresco.repo.content
Class LimitedStreamCopier
- java.lang.Object
-
- org.alfresco.repo.content.LimitedStreamCopier
-
public final class LimitedStreamCopier extends java.lang.ObjectThis class is a simple utility to copy bytes from anInputStreamto anOutputStream. The copy can be performed with an optional byte limit and as soon as this limit is reached, the copy will be stopped immediately and aContentLimitViolationExceptionwill be thrown.- Since:
- Thor
-
-
Constructor Summary
Constructors Constructor Description LimitedStreamCopier()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcopyStreams(java.io.InputStream in, java.io.OutputStream out, long sizeLimit)Copy of the the Spring FileCopyUtils, but does not silently absorb IOExceptions when the streams are closed.longcopyStreamsLong(java.io.InputStream in, java.io.OutputStream out, long sizeLimit)
-
-
-
Method Detail
-
copyStreams
public final int copyStreams(java.io.InputStream in, java.io.OutputStream out, long sizeLimit) throws java.io.IOExceptionCopy of the the Spring FileCopyUtils, but does not silently absorb IOExceptions when the streams are closed. We require the stream write to happen successfully. Both streams are closed but any IOExceptions are thrown- Parameters:
in- the stream from which to read content.out- the stream to which to write content.sizeLimit- the maximum number of bytes that will be copied between the streams before aContentLimitViolationExceptionwill be thrown. A negative number or zero will be deemed to mean 'no limit'.- Throws:
java.io.IOException
-
copyStreamsLong
public final long copyStreamsLong(java.io.InputStream in, java.io.OutputStream out, long sizeLimit) throws java.io.IOException- Throws:
java.io.IOException
-
-