public class MimeStreamWriter extends ByteStream
Stream for writing MIME multipart/mixed messages.
empty
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this stream.
|
MimeStreamWriter |
nestedStream()
Return a new MIME stream writer for a nested multipart/mixed message.
|
static MimeStreamWriter |
newMultipart(java.lang.String boundary,
ByteStream stream)
Return a new MIME stream writer for an outer multipart/mixed message.
|
void |
writeBinary(byte[] data)
Write to this stream the portion of
data from the specified offset with the specified length . |
void |
writeByte(byte value)
Write a single byte to this stream.
|
void |
writePart(MimePart part)
Write a MIME part to the stream, excluding part content which the caller should write with
MimeStreamWriter.writeByte and/or MimeStreamWriter.writeBinary calls. |
asText, copyTo, copyTo, copyToFile, fileWriter, fromBinary, fromBinary, fromBinary, fromFile, fromInput, fromStream, fromText, getCanUndo, getDataType, readAndClose, readBinary, readBinary, readByte, toBuffer, toInput, toString, undoRead, withUndo
flush, getEntityTag, getFileName, getMediaType, setEntityTag, setFileName, setMediaType
cloneMutable, equals, getTypeCode, hashCode
public void close()
Close this stream. Automatically calls StreamBase.flush
before closing.
This function can be safely called if the stream is already closed.
close
in class StreamBase
public MimeStreamWriter nestedStream()
Return a new MIME stream writer for a nested multipart/mixed message.
public static MimeStreamWriter newMultipart(java.lang.String boundary, ByteStream stream)
Return a new MIME stream writer for an outer multipart/mixed message.
boundary
- MIME part boundary.stream
- MIME output stream.public void writeBinary(byte[] data)
Write to this stream the portion of data
from the specified offset
with the specified length
.
writeBinary
in class ByteStream
data
- Source data.public void writeByte(byte value)
Write a single byte to this stream.
writeByte
in class ByteStream
value
- Byte value to be written.public void writePart(MimePart part)
Write a MIME part to the stream, excluding part content which the caller should write with MimeStreamWriter.writeByte
and/or MimeStreamWriter.writeBinary
calls.
part
- MIME part, where one of MimePart.isMultipart
, MimePart.isRequest
, or MimePart.isResponse
must be true
.