Package org.apache.axis.attachments
Class MultiPartRelatedInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.apache.axis.attachments.MultiPartInputStream
-
- org.apache.axis.attachments.MultiPartRelatedInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class MultiPartRelatedInputStream extends MultiPartInputStream
This simulates the multipart stream.- Author:
- Rick Rineholt
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
boundary
Field boundaryprotected BoundaryDelimitedStream
boundaryDelimitedStream
Field boundaryDelimitedStreamprotected java.io.ByteArrayInputStream
cachedSOAPEnvelope
Field cachedSOAPEnvelopeprotected boolean
closed
Field closedprotected java.lang.String
contentId
Field contentIdprotected java.lang.String
contentLocation
Field contentLocationprotected boolean
eos
Field eosprotected static org.apache.commons.logging.Log
log
Field logstatic java.lang.String
MIME_MULTIPART_RELATED
Field MIME_MULTIPART_RELATEDprotected java.util.LinkedList
orderedParts
Field orderedPartsprotected java.util.HashMap
parts
Field partsprotected static java.lang.String[]
READ_ALL
Field READ_ALLprotected int
rootPartLength
Field rootPartLengthprotected java.io.InputStream
soapStream
Field soapStreamprotected java.io.InputStream
soapStreamBDS
Field soapStreamBDS
-
Constructor Summary
Constructors Constructor Description MultiPartRelatedInputStream(java.lang.String contentType, java.io.InputStream stream)
Create a new Multipart stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addPart(java.lang.String contentId, java.lang.String locationId, AttachmentPart ap)
Add anAttachmentPart
together with its content and location IDs.int
available()
void
close()
Part
getAttachmentByReference(java.lang.String[] id)
java.util.Collection
getAttachments()
java.lang.String
getContentId()
Return the content id of the stream.java.lang.String
getContentLocation()
Return the content location.int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
protected void
readAll()
Read all data.protected Part
readTillFound(java.lang.String[] id)
This will read streams in till the one that is needed is found.
-
-
-
Field Detail
-
log
protected static org.apache.commons.logging.Log log
Field log
-
MIME_MULTIPART_RELATED
public static final java.lang.String MIME_MULTIPART_RELATED
Field MIME_MULTIPART_RELATED- See Also:
- Constant Field Values
-
parts
protected java.util.HashMap parts
Field parts
-
orderedParts
protected java.util.LinkedList orderedParts
Field orderedParts
-
rootPartLength
protected int rootPartLength
Field rootPartLength
-
closed
protected boolean closed
Field closed
-
eos
protected boolean eos
Field eos
-
boundaryDelimitedStream
protected BoundaryDelimitedStream boundaryDelimitedStream
Field boundaryDelimitedStream
-
soapStream
protected java.io.InputStream soapStream
Field soapStream
-
soapStreamBDS
protected java.io.InputStream soapStreamBDS
Field soapStreamBDS
-
boundary
protected byte[] boundary
Field boundary
-
cachedSOAPEnvelope
protected java.io.ByteArrayInputStream cachedSOAPEnvelope
Field cachedSOAPEnvelope
-
contentLocation
protected java.lang.String contentLocation
Field contentLocation
-
contentId
protected java.lang.String contentId
Field contentId
-
READ_ALL
protected static final java.lang.String[] READ_ALL
Field READ_ALL
-
-
Constructor Detail
-
MultiPartRelatedInputStream
public MultiPartRelatedInputStream(java.lang.String contentType, java.io.InputStream stream) throws AxisFault
Create a new Multipart stream.- Parameters:
contentType
- the string that holds the contentTypestream
- the true input stream from where the source- Throws:
AxisFault
- if the stream could not be created
-
-
Method Detail
-
getAttachmentByReference
public Part getAttachmentByReference(java.lang.String[] id) throws AxisFault
- Specified by:
getAttachmentByReference
in classMultiPartInputStream
- Throws:
AxisFault
-
addPart
protected void addPart(java.lang.String contentId, java.lang.String locationId, AttachmentPart ap)
Add anAttachmentPart
together with its content and location IDs.- Parameters:
contentId
- the content IDlocationId
- the location IDap
- theAttachmentPart
-
readAll
protected void readAll() throws AxisFault
Read all data.- Throws:
AxisFault
- if there was a problem reading all the data
-
getAttachments
public java.util.Collection getAttachments() throws AxisFault
- Specified by:
getAttachments
in classMultiPartInputStream
- Throws:
AxisFault
-
readTillFound
protected Part readTillFound(java.lang.String[] id) throws AxisFault
This will read streams in till the one that is needed is found.- Parameters:
id
- id is the stream being sought.- Returns:
- the part for the id
- Throws:
AxisFault
-
getContentLocation
public java.lang.String getContentLocation()
Description copied from class:MultiPartInputStream
Return the content location.- Specified by:
getContentLocation
in classMultiPartInputStream
- Returns:
- the Content-Location of the stream. Null if no content-location specified.
-
getContentId
public java.lang.String getContentId()
Description copied from class:MultiPartInputStream
Return the content id of the stream.- Specified by:
getContentId
in classMultiPartInputStream
- Returns:
- the Content-Location of the stream. Null if no content-location specified.
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException
- Overrides:
available
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
-