org.apache.manifoldcf.core.interfaces
Class TempFileInput

java.lang.Object
  extended by org.apache.manifoldcf.core.interfaces.BinaryInput
      extended by 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
static java.lang.String _rcsid
           
protected static int CHUNK_SIZE
           
protected  java.io.File file
           
 
Fields inherited from class org.apache.manifoldcf.core.interfaces.BinaryInput
length, stream
 
Constructor Summary
protected TempFileInput()
           
  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.
 
Method Summary
protected  void calculateLength()
           
 void discard()
          Discard the object
protected  void openStream()
           
 BinaryInput transfer()
          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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_rcsid

public static final java.lang.String _rcsid
See Also:
Constant Field Values

file

protected java.io.File file

CHUNK_SIZE

protected static final int CHUNK_SIZE
See Also:
Constant Field Values
Constructor Detail

TempFileInput

public TempFileInput(java.io.InputStream is)
              throws ManifoldCFException
Construct 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:
ManifoldCFException

TempFileInput

public TempFileInput(java.io.InputStream is,
                     long length)
              throws ManifoldCFException
Construct 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:
ManifoldCFException

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:
transfer in class BinaryInput

discard

public void discard()
             throws ManifoldCFException
Description copied from class: BinaryInput
Discard the object

Overrides:
discard in class BinaryInput
Throws:
ManifoldCFException

openStream

protected void openStream()
                   throws ManifoldCFException
Specified by:
openStream in class BinaryInput
Throws:
ManifoldCFException

calculateLength

protected void calculateLength()
                        throws ManifoldCFException
Specified by:
calculateLength in class BinaryInput
Throws:
ManifoldCFException