com.infoengine.soap
Class SOAPAttachmentInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended bycom.infoengine.object.IeInputStream
          extended bycom.infoengine.object.IeMultipartInputStream
              extended bycom.infoengine.soap.SOAPAttachmentInputStream

class SOAPAttachmentInputStream
extends IeMultipartInputStream

package only access, use specific to SOAP with attachments and the RPCHandler


Field Summary
private  Iterator attachments
           
private  String boundary
           
private  String contentType
           
private  javax.xml.soap.AttachmentPart currentAttachment
           
private  ContentHeader currentHeader
           
private  IeMultipartInputStream currentIs
           
 
Fields inherited from class com.infoengine.object.IeMultipartInputStream
DEFAULT_BOUNDARY, DEFAULT_EOF, DEFAULT_EOL, eofRead, pushedBack, requestContentType
 
Fields inherited from class com.infoengine.object.IeInputStream
 
Fields inherited from class java.io.InputStream
 
Constructor Summary
SOAPAttachmentInputStream(Iterator attachments, javax.xml.soap.MimeHeaders mimeHeaders)
           
 
Method Summary
 int available()
          Returns the number of bytes that can be read without blocking.
 void close()
          Closes the input stream and releases all resources allocated to it.
 String getBoundary()
          Returns the MIME boundary string that separates the content objects read from the stream.
 ContentHeader getContentHeader()
          Returns the last MIME content header object read from the input stream.
 String getContentType()
          Returns the MIME content type associated with the multipart input stream as a whole.
 InputStream getInputStream()
          Returns the input stream currently associated with this object.
 String getParameter(String name)
          Returns the value of a named parameter.
 Enumeration getParameterNames()
          Returns the names of all parameters.
 Vector getParameterValues(String name)
          Returns the values of a named parameter.
 String getRequestContentType()
          Returns the MIME content type associated with the incoming request.
 Enumeration getXGroups()
          returns an Enumeration of IeGroup objects found in the incoming MIME stream.
 void mark(int readLimit)
          Marks the current position in the input stream.
 boolean markSupported()
          Returns an indication of support for input stream marking.
 boolean pushBackCalled()
          Returns an indication of whether any MIME content headers have ever been pushed onto the internal stack.
 void pushBackHeader(ContentHeader header)
          Pushes a MIME content header object onto an internal stack.
 int read()
          Returns a byte from the input stream.
 int read(byte[] b)
          Reads bytes from the input stream into an array.
 int read(byte[] b, int off, int len)
          Read bytes from the input stream into an array or subarray.
 byte[] readBlob()
          Reads the next BLOB on the input stream and returns it as a byte array.
 void readBlob(OutputStream os)
          Reads the next BLOB on the input stream and writes it to an output stream.
 ContentHeader readBlobInfo()
          Reads the next MIME content header from the input stream.
 String readBoundary()
          Reads the next boundary line from the MIME input stream.
 String readLine()
          Reads a line of text from the input stream using the default character encoding for the platform.
 int readLine(byte[] bbuf)
          Reads the next line from the MIME input stream into a byte array.
 int readLine(byte[] bbuf, int start, int max)
          Reads the next line from the MIME input stream into a byte array, beginning at a specific index of the array and continuing until the end of the line is detected or a maximum number of bytes is read.
 String readLine(String encoding)
          Read a line of text from the input stream using a specified character encoding.
 IeRequest readRequest()
          Reads the next content object from the input stream and parses it as an Info*Engine request object.
 String readText()
          Reads the next text object on the input stream and returns it as a String.
 void readText(OutputStream os)
          Reads the next text object on the input stream and writes it to an output stream.
 IeCollection readVdb()
          Reads the next content object from the input stream and parses it as an Info*Engine VDB object.
 void reset()
          Resets the input stream to the position of the last mark set.
 void setInputStream(InputStream is)
          Sets the input stream associated with this object.
 long skip(long n)
          Reads and discards bytes from the input stream.
 void streamBlobs(OutputStream os)
          Copies every BLOB on the input stream to an output stream.
 
Methods inherited from class com.infoengine.object.IeMultipartInputStream
eofRead, getContentLength, readHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attachments

private Iterator attachments

currentHeader

private ContentHeader currentHeader

currentAttachment

private javax.xml.soap.AttachmentPart currentAttachment

currentIs

private IeMultipartInputStream currentIs

contentType

private String contentType

boundary

private String boundary
Constructor Detail

SOAPAttachmentInputStream

public SOAPAttachmentInputStream(Iterator attachments,
                                 javax.xml.soap.MimeHeaders mimeHeaders)
Method Detail

getBoundary

public String getBoundary()
Returns the MIME boundary string that separates the content objects read from the stream.

Overrides:
getBoundary in class IeMultipartInputStream
Returns:
The MIME boundary string.

getContentHeader

public ContentHeader getContentHeader()
Returns the last MIME content header object read from the input stream.

Overrides:
getContentHeader in class IeMultipartInputStream
Returns:
The last content header object read.

getContentType

public String getContentType()
Returns the MIME content type associated with the multipart input stream as a whole.

Overrides:
getContentType in class IeMultipartInputStream
Returns:
The MIME content type of the stream.

getParameter

public String getParameter(String name)
Returns the value of a named parameter. Use this method only when it is known that a parameter is single-valued. Use getParameterValues when a parameter can be multi-valued.

Parameters are available only when an IeMultipartInputStream is derived from a ServletRequest object (see the appropriate constructor above). Parameters are form variables submitted in an HTTP POST request with the MIME type multipart/form-data.

Overrides:
getParameter in class IeMultipartInputStream
Parameters:
name - The name of the parameter.
Returns:
The value of the named parameter, or null if the parameter is not found in the input stream.

getParameterNames

public Enumeration getParameterNames()
Returns the names of all parameters.

Parameters are available only when an IeMultipartInputStream is derived from a ServletRequest object (see the appropriate constructor above). Parameters are form variables submitted in an HTTP POST request with the MIME type multipart/form-data.

Overrides:
getParameterNames in class IeMultipartInputStream
Returns:
The names of all parameters obtained from the input stream.

getParameterValues

public Vector getParameterValues(String name)
Returns the values of a named parameter.

Parameters are available only when an IeMultipartInputStream is derived from a ServletRequest object (see the appropriate constructor above). Parameters are form variables submitted in an HTTP POST request with the MIME type multipart/form-data.

Overrides:
getParameterValues in class IeMultipartInputStream
Parameters:
name - The name of the parameter.
Returns:
The values of the named parameter, or null if the parameter is not found in the input stream.

getRequestContentType

public String getRequestContentType()
Returns the MIME content type associated with the incoming request. This method can be called following a call to readRequest to get the content type of the incoming request object. (typically either 'text/xml' or 'application/java-serialized-object'

Overrides:
getRequestContentType in class IeMultipartInputStream
Returns:
The MIME content type of request.

getXGroups

public Enumeration getXGroups()
returns an Enumeration of IeGroup objects found in the incoming MIME stream.

Overrides:
getXGroups in class IeMultipartInputStream

pushBackCalled

public boolean pushBackCalled()
Returns an indication of whether any MIME content headers have ever been pushed onto the internal stack.

Overrides:
pushBackCalled in class IeMultipartInputStream
Returns:
true if content headers have been pushed onto the stack, false if the stack has never been used.

pushBackHeader

public void pushBackHeader(ContentHeader header)
Pushes a MIME content header object onto an internal stack. This header will be returned in the next call to readBlobInfo(). This allows an application to scan the input stream for a particular kind of content object, then push its MIME header back onto the stream.

Overrides:
pushBackHeader in class IeMultipartInputStream
Parameters:
header - The content header to be pushed onto the stack.

readBlob

public byte[] readBlob()
                throws IOException
Reads the next BLOB on the input stream and returns it as a byte array. Before calling this method, you must call readBlobInfo() to read the MIME header that precedes and describes the BLOB data.

Overrides:
readBlob in class IeMultipartInputStream
Returns:
The byte array containing the BLOB.
Throws:
IOException - if the input stream can not be read successfully.

readBlob

public void readBlob(OutputStream os)
              throws IOException
Reads the next BLOB on the input stream and writes it to an output stream. Before calling this method, you must call readBlobInfo() to read the MIME header that precedes and describes the BLOB data.

Overrides:
readBlob in class IeMultipartInputStream
Parameters:
os - The output stream on which to write the BLOB.
Throws:
IOException - if the input stream can not be read successfully.

readBlobInfo

public ContentHeader readBlobInfo()
                           throws IOException
Reads the next MIME content header from the input stream. You must call this method before calling the readBlob() or readText() methods.

Overrides:
readBlobInfo in class IeMultipartInputStream
Returns:
The MIME content header object.
Throws:
IOException - if the input stream can not be read successfully.

readBoundary

public String readBoundary()
                    throws IOException
Reads the next boundary line from the MIME input stream.

Overrides:
readBoundary in class IeMultipartInputStream
Returns:
The boundary line read.
Throws:
IOException - if the input stream can not be read successfully.

readLine

public int readLine(byte[] bbuf)
             throws IOException
Reads the next line from the MIME input stream into a byte array. If a complete line is read, the array will contain the text of the line as well as the end of line character(s). If the next line is longer than the supplied byte array, the byte array is filled, and the method will need to be called again to read the remainder of the line.

Overrides:
readLine in class IeMultipartInputStream
Parameters:
bbuf - The byte array in which to store the bytes read from the input stream.
Returns:
The number of bytes read into the array.
Throws:
IOException - if the input stream can not be read successfully.

readLine

public int readLine(byte[] bbuf,
                    int start,
                    int max)
             throws IOException
Reads the next line from the MIME input stream into a byte array, beginning at a specific index of the array and continuing until the end of the line is detected or a maximum number of bytes is read. If a complete line is read, the array will contain the text of the line as well as the end of line character(s). If the next line is longer than the maximum number of bytes specified, the method will need to be called again to read the remainder of the line.

Overrides:
readLine in class IeMultipartInputStream
Parameters:
bbuf - The byte array in which to store the bytes read from the input stream.
start - The index of the array in which to store the first byte.
max - The maximum number of bytes to read.
Returns:
The number of bytes read into the array.
Throws:
IOException - if the input stream can not be read successfully.

readRequest

public IeRequest readRequest()
                      throws IOException,
                             IEException
Reads the next content object from the input stream and parses it as an Info*Engine request object.

Overrides:
readRequest in class IeMultipartInputStream
Returns:
The Info*Engine request object read from the input stream.
Throws:
IOException - if the next object on the input stream is not an Info*Engine request object.
IEException

readText

public String readText()
                throws IOException
Reads the next text object on the input stream and returns it as a String. Before calling this method, you must call readBlobInfo() to read the MIME header that precedes and describes the text object.

Overrides:
readText in class IeMultipartInputStream
Returns:
The String containing the test object.
Throws:
IOException - if the input stream can not be read successfully.

readText

public void readText(OutputStream os)
              throws IOException
Reads the next text object on the input stream and writes it to an output stream. Before calling this method, you must call readBlobInfo() to read the MIME header that precedes and describes the text object.

Overrides:
readText in class IeMultipartInputStream
Parameters:
os - The output stream on which to write the text object.
Throws:
IOException - if the input stream can not be read successfully.

readVdb

public IeCollection readVdb()
                     throws IOException,
                            IEException
Reads the next content object from the input stream and parses it as an Info*Engine VDB object.

Overrides:
readVdb in class IeMultipartInputStream
Returns:
The Info*Engine VDB object read from the input stream.
Throws:
IOException - if the next object on the input stream is not an Info*Engine VDB object.
IEException

streamBlobs

public void streamBlobs(OutputStream os)
                 throws IOException
Copies every BLOB on the input stream to an output stream. When this method returns, the input stream is positioned at its end.

Overrides:
streamBlobs in class IeMultipartInputStream
Parameters:
os - The output stream on which to write all of the BLOB's read from the input stream.
Throws:
IOException - if the input stream can not be read or the output stream can not be written successfully.

available

public int available()
              throws IOException
Returns the number of bytes that can be read without blocking.

Overrides:
available in class IeInputStream
Returns:
The number of bytes that can be read without blocking.
Throws:
IOException - if the number of available bytes can not be determined.

close

public void close()
           throws IOException
Closes the input stream and releases all resources allocated to it.

Overrides:
close in class IeInputStream
Throws:
IOException - if the output stream can not be closed.

getInputStream

public InputStream getInputStream()
Returns the input stream currently associated with this object.

Overrides:
getInputStream in class IeInputStream
Returns:
The input stream currently associated with this object.

mark

public void mark(int readLimit)
Marks the current position in the input stream.

Overrides:
mark in class IeInputStream
Parameters:
readLimit - The position to be marked.

markSupported

public boolean markSupported()
Returns an indication of support for input stream marking.

Overrides:
markSupported in class IeInputStream
Returns:
true if marking is supported.

read

public int read()
         throws IOException
Returns a byte from the input stream.

Overrides:
read in class IeInputStream
Returns:
The next byte from input stream, or -1 if the stream is positioned at end of file.
Throws:
IOException - if the input stream can not be read.

read

public int read(byte[] b)
         throws IOException
Reads bytes from the input stream into an array. This method blocks until the array can be filled, or the end of the stream is reached.

Overrides:
read in class IeInputStream
Parameters:
b - The array in which to store the bytes read.
Returns:
The number of bytes stored in the array, or -1 if the input stream is positioned at end of file.
Throws:
IOException - if the input stream can not be read.

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Read bytes from the input stream into an array or subarray. This method blocks until the maximum specified number of bytes are read, or the end of the stream is reached.

Overrides:
read in class IeInputStream
Parameters:
b - The array in which to store the bytes read.
off - The offset in the array at which to begin storing bytes.
len - The maximum number of bytes to read.
Returns:
The number of bytes read, or -1 if the input stream is positioned at end of file.
Throws:
IOException - if the input stream can not be read.

readLine

public String readLine()
                throws IOException
Reads a line of text from the input stream using the default character encoding for the platform.

Overrides:
readLine in class IeInputStream
Returns:
The line of text read, with end of line sequence removed, or null if the stream is positioned at end of file.
Throws:
IOException - if the input stream can not be read.

readLine

public String readLine(String encoding)
                throws IOException
Read a line of text from the input stream using a specified character encoding.

Overrides:
readLine in class IeInputStream
Parameters:
encoding - the character encoding to apply to the connection
Returns:
A line of text with end of line sequence removed
Throws:
IOException

reset

public void reset()
           throws IOException
Resets the input stream to the position of the last mark set.

Overrides:
reset in class IeInputStream
Throws:
IOException - if the input stream can not be reset.

setInputStream

public void setInputStream(InputStream is)
Sets the input stream associated with this object.

Overrides:
setInputStream in class IeInputStream
Parameters:
is - The input stream to associate with this object.

skip

public long skip(long n)
          throws IOException
Reads and discards bytes from the input stream.

Overrides:
skip in class IeInputStream
Parameters:
n - The number of bytes to read and discard.
Returns:
The actual number of bytes read and discarded.
Throws:
IOException - if the input stream can not be read.