Modifier and Type | Field and Description |
---|---|
static String |
CHARSET
Content charset
|
static byte[] |
CHARSET_BYTES
Content charset as a byte array
|
static String |
CONTENT_DISPOSITION
Content disposition characters
|
static byte[] |
CONTENT_DISPOSITION_BYTES
Content disposition as a byte array
|
static String |
CONTENT_ID
Content type header
|
static byte[] |
CONTENT_ID_BYTES
Content type header as a byte array
|
static String |
CONTENT_TRANSFER_ENCODING
Content type header
|
static byte[] |
CONTENT_TRANSFER_ENCODING_BYTES
Content type header as a byte array
|
static String |
CONTENT_TYPE
Content type header
|
static byte[] |
CONTENT_TYPE_BYTES
Content type header as a byte array
|
static String |
CRLF
Carriage return/linefeed
|
static byte[] |
CRLF_BYTES
Carriage return/linefeed as a byte array
|
static String |
EXTRA
Extra characters
|
static byte[] |
EXTRA_BYTES
Extra characters as a byte array
|
static String |
FORM_DATA_DISPOSITION_TYPE
form-data characters
|
static byte[] |
FORM_DATA_DISPOSITION_TYPE_BYTES
form-data as a byte array
|
static String |
NAME
name characters
|
static byte[] |
NAME_BYTES
name as a byte array
|
static String |
QUOTE
Content dispostion characters
|
static byte[] |
QUOTE_BYTES
Content dispostion as a byte array
|
Constructor and Description |
---|
Part() |
Modifier and Type | Method and Description |
---|---|
protected long |
contentIdHeaderLength() |
protected long |
contentTypeHeaderLength() |
protected long |
dispositionHeaderLength() |
protected long |
endLength() |
protected long |
endOfHeaderLength() |
abstract String |
getCharSet()
Return the character encoding of this part.
|
abstract String |
getContentId()
Return the content ID of this part.
|
abstract String |
getContentType()
Returns the content type of this part.
|
String |
getDispositionType()
Gets the disposition-type to be used in Content-Disposition header
|
static long |
getLengthOfParts(Part[] parts,
byte[] partBoundary)
Gets the length of the multipart message including the given parts.
|
abstract String |
getName()
Return the name of this part.
|
abstract String |
getTransferEncoding()
Return the transfer encoding of this part.
|
long |
length(byte[] boundary)
Return the full length of all the data.
|
protected abstract long |
lengthOfData()
Return the length of the main content
|
void |
send(OutputStream out,
byte[] boundary)
Write all the data to the output stream.
|
protected void |
sendContentIdHeader(OutputStream out)
Write the content ID header to the specified output stream
|
protected void |
sendContentTypeHeader(OutputStream out)
Write the content type header to the specified output stream
|
protected abstract void |
sendData(OutputStream out)
Write the data to the specified output stream
|
protected void |
sendDispositionHeader(OutputStream out)
Write the content disposition header to the specified output stream
|
protected void |
sendEnd(OutputStream out)
Write the end data to the output stream.
|
protected void |
sendEndOfHeader(OutputStream out)
Write the end of the header to the output stream
|
static void |
sendMessageEnd(OutputStream out,
byte[] partBoundary) |
static void |
sendPart(OutputStream out,
Part part,
byte[] partBoundary)
Write all parts and the last boundary to the specified output stream.
|
static void |
sendParts(OutputStream out,
Part[] parts,
byte[] partBoundary)
Write all parts and the last boundary to the specified output stream.
|
protected void |
sendStart(OutputStream out,
byte[] boundary)
Write the start to the specified output stream
|
protected void |
sendTransferEncodingHeader(OutputStream out)
Write the content transfer encoding header to the specified output stream
|
void |
setDispositionType(String dispositionType) |
String |
toString()
Return a string representation of this object.
|
protected long |
transferEncodingHeaderLength() |
public static final String CRLF
public static final byte[] CRLF_BYTES
public static final String QUOTE
public static final byte[] QUOTE_BYTES
public static final String EXTRA
public static final byte[] EXTRA_BYTES
public static final String CONTENT_DISPOSITION
public static final byte[] CONTENT_DISPOSITION_BYTES
public static final String FORM_DATA_DISPOSITION_TYPE
public static final byte[] FORM_DATA_DISPOSITION_TYPE_BYTES
public static final String NAME
public static final byte[] NAME_BYTES
public static final String CONTENT_TYPE
public static final byte[] CONTENT_TYPE_BYTES
public static final String CHARSET
public static final byte[] CHARSET_BYTES
public static final String CONTENT_TRANSFER_ENCODING
public static final byte[] CONTENT_TRANSFER_ENCODING_BYTES
public static final String CONTENT_ID
public static final byte[] CONTENT_ID_BYTES
public abstract String getName()
public abstract String getContentType()
null
to exclude the content type headerpublic abstract String getCharSet()
null
to exclude the character encoding headerpublic abstract String getTransferEncoding()
null
to exclude the transfer encoding headerpublic abstract String getContentId()
null
to exclude the content ID headerpublic String getDispositionType()
public void setDispositionType(String dispositionType)
protected void sendStart(OutputStream out, byte[] boundary) throws IOException
out
- The output streamboundary
- the boundaryIOException
- If an IO problem occurs.protected void sendDispositionHeader(OutputStream out) throws IOException
out
- The output streamIOException
- If an IO problem occurs.protected long dispositionHeaderLength()
protected void sendContentTypeHeader(OutputStream out) throws IOException
out
- The output streamIOException
- If an IO problem occurs.protected long contentTypeHeaderLength()
protected void sendTransferEncodingHeader(OutputStream out) throws IOException
out
- The output streamIOException
- If an IO problem occurs.protected long transferEncodingHeaderLength()
protected void sendContentIdHeader(OutputStream out) throws IOException
out
- The output streamIOException
- If an IO problem occurs.protected long contentIdHeaderLength()
protected void sendEndOfHeader(OutputStream out) throws IOException
out
- The output streamIOException
- If an IO problem occurs.protected long endOfHeaderLength()
protected abstract void sendData(OutputStream out) throws IOException
out
- The output streamIOException
- If an IO problem occurs.protected abstract long lengthOfData()
protected void sendEnd(OutputStream out) throws IOException
out
- The output streamIOException
- If an IO problem occurs.protected long endLength()
public void send(OutputStream out, byte[] boundary) throws IOException
out
- The output streamboundary
- the boundaryIOException
- If an IO problem occurs.public long length(byte[] boundary)
IOException
- If an IO problem occurspublic String toString()
toString
in class Object
Object.toString()
public static void sendParts(OutputStream out, Part[] parts, byte[] partBoundary) throws IOException
out
- The stream to write to.parts
- The parts to write.partBoundary
- The ASCII bytes to use as the part boundary.IOException
- If an I/O error occurs while writing the parts.public static void sendMessageEnd(OutputStream out, byte[] partBoundary) throws IOException
IOException
public static void sendPart(OutputStream out, Part part, byte[] partBoundary) throws IOException
out
- The stream to write to.part
- The part to write.IOException
- If an I/O error occurs while writing the parts.public static long getLengthOfParts(Part[] parts, byte[] partBoundary)
parts
- The parts.partBoundary
- The ASCII bytes to use as the part boundary.IOException
- If an I/O error occurs while writing the parts.Copyright © 2014. All Rights Reserved.