FileNet Content Services
Java Connector v3.0

com.filenet.wcm.api
Class TransportInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended bycom.filenet.wcm.api.impl.SerializableTransportInputStream
              extended bycom.filenet.wcm.api.TransportInputStream
All Implemented Interfaces:
java.io.Serializable

public class TransportInputStream
extends com.filenet.wcm.api.impl.SerializableTransportInputStream
implements java.io.Serializable

A TransportInputStream object is used for uploading (sending) or downloading (receiving) content to or from the Content Services server. An instance of this class acts like a java.io.FilterInputStream, but it also has accessor methods for other items of information.

See Also:
CS Java Toolkit Developer's Guide, Serialized Form

Field Summary
static long CONTENT_SIZE_UNKNOWN
          This value, which is the default if setContentSize() is not called, means that the content size is not known.
 
Constructor Summary
TransportInputStream(java.io.InputStream in)
          Creates a TransportInputStream object and saves its argument, the input stream in, for later use.
TransportInputStream(java.io.InputStream in, long contentSize, int contentElement, java.lang.String mimeType, java.lang.String filename)
          Creates a TransportInputStream object with the specified content size, content element number, MIME type, and filename and saves its argument, the input stream in, for later use.
 
Method Summary
 int getContentElement()
          Returns the content element number for the input stream.
 long getContentSize()
          Returns the number of bytes in the input stream.
 java.io.InputStream getContentStream()
          Returns the underlying Java InputStream object that TransportInputStream has wrapped for transport to or from the Content Services server.
 java.lang.String getFilename()
          Returns the filename of the underlying document for the input stream.
 java.lang.String getMimeType()
          Returns the MIME type of the underlying document for the input stream.
 void setContentElement(int contentElement)
          Sets the content element number.
 void setContentSize(long contentSize)
          Sets the number of bytes in the input stream.
 void setFilename(java.lang.String filename)
          Sets the filename of the underlying document for the stream.
 void setMimeType(java.lang.String mimeType)
          

Not Applicable in CS Java Connector v3.0.

 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, read, read, reset, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTENT_SIZE_UNKNOWN

public static final long CONTENT_SIZE_UNKNOWN
This value, which is the default if setContentSize() is not called, means that the content size is not known.

See Also:
Constant Field Values
Constructor Detail

TransportInputStream

public TransportInputStream(java.io.InputStream in,
                            long contentSize,
                            int contentElement,
                            java.lang.String mimeType,
                            java.lang.String filename)
Creates a TransportInputStream object with the specified content size, content element number, MIME type, and filename and saves its argument, the input stream in, for later use.

Parameters:
in - The underlying input stream.

contentSize - The number of bytes in the input stream.

contentElement - The content element number. Content element numbering begins at 1.

mimeType - The MIME type of the underlying document for the input stream.

filename - The filename of the underlying document for the input stream.

TransportInputStream

public TransportInputStream(java.io.InputStream in)
Creates a TransportInputStream object and saves its argument, the input stream in, for later use.

Parameters:
in - The underlying input stream.
Method Detail

getMimeType

public java.lang.String getMimeType()
Returns the MIME type of the underlying document for the input stream.

To determine the mime type of a downloaded document, this method reads mimeTypes.properties, a configuration file in the CS Java Toolkit. This configuration file maps file extensions to mime types. If TransportInputStream cannot locate a mime type by file extension, it returns the "application/octet-stream" mime type.

You can modify mimeTypes.properties if needed -- see CS Java Toolkit Developer's Guide for more information.

Returns:
A String indicating the MIME type, or null if not known.

setMimeType

public void setMimeType(java.lang.String mimeType)

Not Applicable in CS Java Connector v3.0.

Sets the MIME type of the underlying document for the input stream.

Parameters:
mimeType - The MIME type to set.

getContentSize

public long getContentSize()
Returns the number of bytes in the input stream.

Returns:
A long indicating the content size or CONTENT_SIZE_UNKNOWN.

setContentSize

public void setContentSize(long contentSize)
Sets the number of bytes in the input stream. The default value is CONTENT_SIZE_UNKNOWN.

Parameters:
contentSize - The content size in bytes.

getContentElement

public int getContentElement()
Returns the content element number for the input stream.

Note: The Content Services Java Connector supports only the first content element.

Returns:
An int indicating the content element number.

setContentElement

public void setContentElement(int contentElement)
Sets the content element number. If this method is never called, a default content element of 1 is assumed. Content elements are numbered from 1.

Note: The Content Services Java Connector supports only the first content element.

Parameters:
contentElement - The content element number to set.

getFilename

public java.lang.String getFilename()
Returns the filename of the underlying document for the input stream.

Returns:
A String representing the filename, or null if not known.

setFilename

public void setFilename(java.lang.String filename)
Sets the filename of the underlying document for the stream.

Parameters:
filename - The filename to set.

getContentStream

public java.io.InputStream getContentStream()
Returns the underlying Java InputStream object that TransportInputStream has wrapped for transport to or from the Content Services server.

Returns:
The underlying Java InputStream object.

FileNet Content Services
Java Connector v3.0