Class TempFileInput
- java.lang.Object
-
- org.apache.manifoldcf.core.interfaces.PersistentDatabaseObject
-
- org.apache.manifoldcf.core.interfaces.BinaryInput
-
- org.apache.manifoldcf.core.interfaces.TempFileInput
-
public class TempFileInput extends BinaryInput
This class represents a temporary file data input stream. Call the "done" method to clean up the file when done. NOTE: The implied flow of this method is to be handled a file that has already been created by some means. The file must be a dedicated temporary file, which can be destroyed when the data has been used.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String_rcsidprotected static intCHUNK_SIZEprotected static intDEFAULT_MAX_MEM_SIZEprotected java.io.Filefileprotected byte[]inMemoryBuffer-
Fields inherited from class org.apache.manifoldcf.core.interfaces.BinaryInput
length, stream
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTempFileInput()TempFileInput(java.io.File tempFile)Construct from an existing temporary fle.TempFileInput(java.io.InputStream is)Construct from an input stream.TempFileInput(java.io.InputStream is, long length)Construct from a length-delimited input stream.TempFileInput(java.io.InputStream is, long length, int maxMemSize)Construct from a length-delimited input stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcalculateLength()voiddiscard()Discard the objectprotected voidopenStream()BinaryInputtransfer()Transfer to a new object; this causes the current object to become "already discarded"-
Methods inherited from class org.apache.manifoldcf.core.interfaces.BinaryInput
closeStream, doneWithStream, getLength, getStream, handleIOException
-
-
-
-
Field Detail
-
_rcsid
public static final java.lang.String _rcsid
- See Also:
- Constant Field Values
-
file
protected java.io.File file
-
inMemoryBuffer
protected byte[] inMemoryBuffer
-
CHUNK_SIZE
protected static final int CHUNK_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_MAX_MEM_SIZE
protected static final int DEFAULT_MAX_MEM_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TempFileInput
public TempFileInput(java.io.InputStream is) throws ManifoldCFException, java.io.IOExceptionConstruct from an input stream. This will also create a temporary, backing file.- Parameters:
is- is the input stream to use to construct the temporary file.- Throws:
ManifoldCFExceptionjava.io.IOException
-
TempFileInput
public TempFileInput(java.io.InputStream is, long length) throws ManifoldCFException, java.io.IOExceptionConstruct from a length-delimited input stream.- Parameters:
is- is the input stream.length- is the maximum number of bytes to transfer, or -1 if no limit.- Throws:
ManifoldCFExceptionjava.io.IOException
-
TempFileInput
public TempFileInput(java.io.InputStream is, long length, int maxMemSize) throws ManifoldCFException, java.io.IOExceptionConstruct from a length-delimited input stream.- Parameters:
is- is the input stream.length- is the maximum number of bytes to transfer, or -1 if no limit.maxMemSize- is the maximum bytes we keep in memory in lieu of using a file.- Throws:
ManifoldCFExceptionjava.io.IOException
-
TempFileInput
public TempFileInput(java.io.File tempFile)
Construct from an existing temporary fle.- Parameters:
tempFile- is the existing temporary file.
-
TempFileInput
protected TempFileInput()
-
-
Method Detail
-
transfer
public BinaryInput transfer()
Transfer to a new object; this causes the current object to become "already discarded"- Specified by:
transferin classBinaryInput
-
discard
public void discard() throws ManifoldCFExceptionDescription copied from class:BinaryInputDiscard the object- Overrides:
discardin classBinaryInput- Throws:
ManifoldCFException
-
openStream
protected void openStream() throws ManifoldCFException- Specified by:
openStreamin classBinaryInput- Throws:
ManifoldCFException
-
calculateLength
protected void calculateLength() throws ManifoldCFException- Specified by:
calculateLengthin classBinaryInput- Throws:
ManifoldCFException
-
-