|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SK.gnome.dwarf.mail.mime.StreamMimePart
Provides a stream-based MimePart implementation.
This class implements the MimePart
interface. The source data is read from
input stream via a SharedInputStreamSource
instance.
Constructor Summary | |
|
StreamMimePart(SharedInputStreamSource in)
Creates a new StreamMimePart. |
protected |
StreamMimePart(SharedInputStreamSource source,
int offset,
int length)
Creates a new StreamMimePart with the given offset and length. |
Method Summary | |
java.io.InputStream |
getContentInputStream()
Returns the content input stream. |
int |
getContentSize()
Returns the content size. |
java.io.InputStream |
getDecodedInputStream()
Returns the decoded content input stream. |
java.lang.String[] |
getHeader(java.lang.String name)
Returns all values of the given header. |
java.lang.String |
getHeader(java.lang.String name,
java.lang.String delimiter)
Returns all values of the given header, delimited by the given character sequence. |
java.util.Iterator |
getHeaderLines()
Returns all header lines. |
java.util.Iterator |
getHeaderNames()
Returns all header names. |
int |
getLineCount()
Returns the line count of the body. |
java.util.Iterator |
getMatchingHeaderLines(java.lang.String[] names)
Returns matching header lines. |
MimePart |
getMimePart(int number)
Returns the nested MIME part. |
int |
getMimePartCount()
Returns the number of nested MIME parts. |
java.util.Iterator |
getNonMatchingHeaderLines(java.lang.String[] names)
Returns non matching header lines. |
java.io.InputStream |
getRawInputStream()
Returns the raw input stream. |
int |
getRawSize()
Returns the raw size of this part. |
boolean |
isMimeType(java.lang.String type)
Whether this MIME part if of the given type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StreamMimePart(SharedInputStreamSource in) throws MimeException
in
- the stream sourceprotected StreamMimePart(SharedInputStreamSource source, int offset, int length) throws MimeException
The new MIME part will begin at the given offset of the stream source and will be limited to the length bytes.
source
- the stream sourceoffset
- the stream offsetlength
- the stream lengthMethod Detail |
public java.util.Iterator getHeaderNames() throws MimeException
MimePart
getHeaderNames
in interface MimePart
MimeException
- if a MIME syntax error occuredpublic java.lang.String[] getHeader(java.lang.String name) throws MimeException
MimePart
getHeader
in interface MimePart
name
- the header name
MimeException
- if a MIME syntax error occuredpublic java.lang.String getHeader(java.lang.String name, java.lang.String delimiter) throws MimeException
MimePart
getHeader
in interface MimePart
name
- the header namedelimiter
- the value delimiter
MimeException
- if a MIME syntax error occuredpublic java.util.Iterator getHeaderLines() throws MimeException
MimePart
The header lines are returned in the exact form as they appear in the MIME part.
getHeaderLines
in interface MimePart
MimeException
- if a MIME syntax error occuredpublic java.util.Iterator getMatchingHeaderLines(java.lang.String[] names) throws MimeException
MimePart
The header lines are returned in the exact form as they appear in the MIME part.
getMatchingHeaderLines
in interface MimePart
names
- the header names
MimeException
- if a MIME syntax error occuredpublic java.util.Iterator getNonMatchingHeaderLines(java.lang.String[] names) throws MimeException
MimePart
The header lines are returned in the exact form as they appear in the MIME part.
getNonMatchingHeaderLines
in interface MimePart
names
- the header names
MimeException
- if a MIME syntax error occuredpublic boolean isMimeType(java.lang.String type) throws MimeException
MimePart
The type argument must be in the form of "type/subtype" pair. If wildcard character "*" is used as the subtype, the method will test only the main type. The type matching is case insensitive.
isMimeType
in interface MimePart
type
- the mime type
MimeException
- if a MIME syntax error occuredpublic int getRawSize()
MimePart
Returns the size of the whole MIME part including the header.
getRawSize
in interface MimePart
public int getContentSize() throws MimeException
MimePart
Returns the size of content-encoded MIME part body.
getContentSize
in interface MimePart
MimeException
- if a MIME syntax error occuredpublic int getLineCount() throws java.io.IOException, MimeException
MimePart
Returns the total line count of the content-encoded MIME part body.
getLineCount
in interface MimePart
MimeException
- if a MIME syntax error occured
java.io.IOException
- if an I/O error occuredpublic java.io.InputStream getRawInputStream() throws java.io.IOException, MimeException
MimePart
Returns the input stream of the whole MIME part including the header.
getRawInputStream
in interface MimePart
MimeException
- if a MIME syntax error occured
java.io.IOException
- if an I/O error occuredpublic java.io.InputStream getContentInputStream() throws java.io.IOException, MimeException
MimePart
Returns the input stream of the content-encoded MIME part body.
getContentInputStream
in interface MimePart
java.io.IOException
- if an I/O error occured
MimeException
- if a MIME syntax error occuredpublic java.io.InputStream getDecodedInputStream() throws java.io.IOException, MimeException
MimePart
Returns the input stream of the content-decoded MIME part body.
getDecodedInputStream
in interface MimePart
java.io.IOException
- if an I/O error occured
MimeException
- if a MIME syntax error occuredpublic int getMimePartCount() throws MimeException
MimePart
Returns the total number of nested MIME parts. The parts are numbered from zero. Only parts of type "multipart/*" or "message/rfc822" are regarded as multipart. If the part if of type "message/rfc822", it has only one directly nested part - the RFC822 message itself, which may in turn contain another MIME parts, if it is a multipart message.
getMimePartCount
in interface MimePart
MimeException
- if a MIME syntax error occuredpublic MimePart getMimePart(int number) throws MimeException
MimePart
getMimePart
in interface MimePart
number
- the part number
MimeException
- if a MIME syntax error occured
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |