Package org.apache.axis.attachments
Class MultiPartDimeInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.apache.axis.attachments.MultiPartInputStream
-
- org.apache.axis.attachments.MultiPartDimeInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class MultiPartDimeInputStream extends MultiPartInputStream
This simulates the multipart stream.- Author:
- Rick Rineholt
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]boundaryprotected java.io.ByteArrayInputStreamcachedSOAPEnvelopeprotected booleanclosedprotected java.lang.StringcontentIdprotected DimeDelimitedInputStreamdimeDelimitedStreamprotected booleaneosprotected static org.apache.commons.logging.Loglogprotected java.util.LinkedListorderedPartsprotected java.util.HashMappartsprotected static java.lang.String[]READ_ALLprotected introotPartLengthprotected java.io.InputStreamsoapStream
-
Constructor Summary
Constructors Constructor Description MultiPartDimeInputStream(java.io.InputStream is)Create a new Multipart stream from an input stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddPart(java.lang.String contentId, java.lang.String locationId, AttachmentPart ap)voidclose()PartgetAttachmentByReference(java.lang.String[] id)java.util.CollectiongetAttachments()java.lang.StringgetContentId()Return the content id of the stream.java.lang.StringgetContentLocation()Return the content location.intread()intread(byte[] b)intread(byte[] b, int off, int len)protected voidreadAll()protected PartreadTillFound(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
-
parts
protected java.util.HashMap parts
-
orderedParts
protected java.util.LinkedList orderedParts
-
rootPartLength
protected int rootPartLength
-
closed
protected boolean closed
-
eos
protected boolean eos
-
dimeDelimitedStream
protected DimeDelimitedInputStream dimeDelimitedStream
-
soapStream
protected java.io.InputStream soapStream
-
boundary
protected byte[] boundary
-
cachedSOAPEnvelope
protected java.io.ByteArrayInputStream cachedSOAPEnvelope
-
contentId
protected java.lang.String contentId
-
READ_ALL
protected static final java.lang.String[] READ_ALL
-
-
Constructor Detail
-
MultiPartDimeInputStream
public MultiPartDimeInputStream(java.io.InputStream is) throws java.io.IOExceptionCreate a new Multipart stream from an input stream.- Parameters:
is- the true input stream that is read from- Throws:
java.io.IOException- if it was not possible to build the Multipart
-
-
Method Detail
-
getAttachmentByReference
public Part getAttachmentByReference(java.lang.String[] id) throws AxisFault
- Specified by:
getAttachmentByReferencein classMultiPartInputStream- Throws:
AxisFault
-
addPart
protected void addPart(java.lang.String contentId, java.lang.String locationId, AttachmentPart ap)
-
getAttachments
public java.util.Collection getAttachments() throws AxisFault- Specified by:
getAttachmentsin classMultiPartInputStream- Throws:
AxisFault
-
readTillFound
protected Part readTillFound(java.lang.String[] id) throws java.io.IOException
This will read streams in till the one that is needed is found.- Parameters:
id- is the stream being sought- Returns:
- a
Partmatching the ids - Throws:
java.io.IOException
-
getContentLocation
public java.lang.String getContentLocation()
Return the content location.- Specified by:
getContentLocationin classMultiPartInputStream- Returns:
- the Content-Location of the stream. Null if no content-location specified.
-
getContentId
public java.lang.String getContentId()
Return the content id of the stream.- Specified by:
getContentIdin 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:
readin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException- Overrides:
readin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException- Overrides:
readin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.FilterInputStream- Throws:
java.io.IOException
-
-