|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
com.infoengine.object.IeMultipartOutputStream
This class defines and manages the content and format of output streams that flow between components of the Info*Engine architecture.
Nested Class Summary | |
(package private) class |
IeMultipartOutputStream.BitBucket
|
Field Summary | |
protected String |
boundary
|
private static String |
CONTENT_TYPE
|
protected int |
contentLength
|
private static byte[] |
CRLF
|
private static byte[] |
DASH2
|
private static String |
DISPOSITION
|
protected String |
encoding
|
protected boolean |
eof
|
private static String |
FILENAME
|
private static String |
FILENAME_STAR
|
protected String |
forceEncoding
|
private static String |
NAME
|
protected OutputStream |
out
|
private static String |
RESOURCE
|
private static long |
seqNum
|
Constructor Summary | |
IeMultipartOutputStream(OutputStream out)
Constructs an Info*Engine multipart output stream by wrapping a basic output stream. |
|
IeMultipartOutputStream(OutputStream out,
IeMultipartInputStream in)
Constructs an Info*Engine multipart output stream by wrapping a basic output stream and obtaining boundary and content type information from an Info*Engine servlet multipart input stream. |
|
IeMultipartOutputStream(OutputStream out,
String boundary)
Constructs an Info*Engine multipart output stream by wrapping a basic output stream and providing a specific boundary string for separating the objects transmitted in the stream. |
Method Summary | |
void |
close()
Closes the output stream and releases resources allocated to it. |
boolean |
eofWritten()
Tests whether an end of file indication (MIME termination boundary) has been written to the stream. |
void |
flush()
Flushes any output buffered on the output stream. |
protected void |
initialize(String contentType,
int contentLength,
String boundary)
|
protected void |
initialize(String contentType,
String boundary)
|
private boolean |
isUsASCII(String s)
|
void |
print(String data)
Prints a string to the output stream. |
void |
println(String data)
Prints a string to the output stream with a CR/LF sequence appended. |
void |
setCharacterSet(String encoding)
Sets the character set encoding to use when converting Info*Engine request objects to XML. |
void |
setForceEncoding(String encoding)
Sets an encoding to use when writing text output. |
void |
write(byte[] b)
Writes an array of bytes to the output stream. |
void |
write(byte[] b,
int off,
int len)
Writes a segment of an array of bytes to the output stream. |
void |
write(int b)
Writes a single byte to the output stream. |
void |
write(String name,
String filename,
String contentType)
Writes a MIME content object header to the output stream. |
void |
write(String data,
String name,
String filename,
String contentType)
Writes one content object of a MIME multipart object to the output stream. |
void |
writeBlob(InputStream content,
String name,
String filename,
String contentType)
Writes one content object of a MIME multipart object to the output stream. |
void |
writeBlob(InputStream content,
String name,
String filename,
String contentType,
boolean flag)
Deprecated. Use writeBlob() without the flag argument instead. |
private void |
writeContentType(String contentType)
|
private void |
writeDisposition(String name,
String filename)
|
void |
writeEOF()
Writes a MIME multipart object termination boundary to the output stream. |
void |
writeRequest(IeRequest request)
Writes an Info*Engine request object to the output stream. |
void |
writeRequest(IeRequest request,
String contentType)
Writes an Info*Engine request object to the output stream serializing according to contentType. |
void |
writeRequest(IeRequest request,
String contentType,
boolean exception)
Writes an Info*Engine request object to the output stream serializing according to contentType. |
void |
writeVdb(IeCollection vdb,
String contentType)
Writes an Info*Engine VDB object to the output stream serializing according to contentType. |
void |
writeVdb(IeCollection vdb,
String contentType,
boolean exception)
Writes an Info*Engine VDB object to the output stream serializing according to contentType. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected OutputStream out
protected String encoding
protected String forceEncoding
protected boolean eof
protected int contentLength
protected String boundary
private static final String RESOURCE
private static final String DISPOSITION
private static final String NAME
private static final String FILENAME
private static final String FILENAME_STAR
private static final String CONTENT_TYPE
private static final byte[] CRLF
private static final byte[] DASH2
private static long seqNum
Constructor Detail |
public IeMultipartOutputStream(OutputStream out) throws IOException
out
- The basic output stream to be wrapped.
IOException
- if the class instance is not initialized
successfully.public IeMultipartOutputStream(OutputStream out, String boundary) throws IOException
out
- The basic output stream to be wrapped.boundary
- The boundary string to be used in separating objects
transmitted in the stream. If null is specified, the
constructor creates a new boundary. If an empty string
is specified, no content headers or boundaries are
generated by this instance of the class.
IOException
- if the class instance is not initialized
successfully.public IeMultipartOutputStream(OutputStream out, IeMultipartInputStream in) throws IOException
out
- The basic output stream to be wrapped.in
- The servlet multipart input stream from which to obtain a
boundary string and content type.
IOException
- if the class instance is not initialized
successfully.Method Detail |
public void flush() throws IOException
IOException
- if buffered output is not flushed successfully.public void close() throws IOException
IOException
- if buffered output is not flushed successfully.public void setCharacterSet(String encoding)
encoding
- The character set encoding name.public void setForceEncoding(String encoding)
encoding
- The character set encoding name.public void write(byte[] b) throws IOException
b
- The array of bytes to be written.
IOException
- if the array is not written successfully.public void write(byte[] b, int off, int len) throws IOException
b
- The array of bytes to be written.off
- The index of the first byte to be written.len
- The number of bytes to be written, starting at off.
IOException
- if the segment is not written successfully.public void write(int b) throws IOException
b
- The byte to be written.
IOException
- if the segment is not written successfully.public void write(String data, String name, String filename, String contentType) throws IOException
data
- The string to be written to the output stream as the
content data.name
- The name to be specified in the Content-Disposition header
of the content object.filename
- The filename to be specified in the Content-Disposition
header of the content object.contentType
- The MIME content type to be specified in the
Content-Type header of the content object.
IOException
- if the content object is not written
successfully.public void write(String name, String filename, String contentType) throws IOException
name
- The name to be specified in a Content-Disposition header.filename
- The filename to be specified in a Content-Disposition
header.contentType
- The MIME content type to be specified a the
Content-Type header.
IOException
- if the content object is not written
successfully.public void writeBlob(InputStream content, String name, String filename, String contentType) throws IOException
content
- The input stream containing the bytes to be written to
the output stream as the content data.name
- The name to be specified in the Content-Disposition header
of the content object.filename
- The filename to be specified in the Content-Disposition
header of the content object.contentType
- The MIME content type to be specified in the
Content-Type header of the content object.
IOException
- if the content object is not written
successfully.public void writeBlob(InputStream content, String name, String filename, String contentType, boolean flag) throws IOException
content
- The input stream containing the bytes to be written to
the output stream as the content data.name
- The name to be specified in the Content-Disposition header
of the content object.filename
- The filename to be specified in the Content-Disposition
header of the content object.contentType
- The MIME content type to be specified in the
Content-Type header of the content object.flag
- Ignored.
IOException
- if the content object is not written
successfully.public void writeRequest(IeRequest request) throws IOException
request
- The Info*Engine request object to be written.
IOException
- if the request object is not written
successfully.public void writeRequest(IeRequest request, String contentType) throws IOException
request
- The Info*Engine request object to be written.contentType
- The MIME content type to associate with the request.
Currently accepts text/xml or
application/java-serialized-object. If null,
will use application/java-serialized-object.
IOException
- if the request object is not written
successfully.public void writeRequest(IeRequest request, String contentType, boolean exception) throws IOException
request
- The Info*Engine request object to be written.contentType
- The MIME content type to associate with the request.
Currently accepts text/xml or
application/java-serialized-object. If null,
will use application/java-serialized-object.exception
- States whether this request is the result of an
exception or not. If true the MIME part for the
request will be named "exception". If false the MIME
part will be named "request".
IOException
- if the request object is not written
successfully.public void writeVdb(IeCollection vdb, String contentType) throws IOException
vdb
- The Info*Engine VDB object to be written.contentType
- The MIME content type to associate with the request.
Currently accepts text/xml or
application/java-serialized-object. If null,
will use text/xml.
IOException
- if the request object is not written
successfully.public void writeVdb(IeCollection vdb, String contentType, boolean exception) throws IOException
vdb
- The Info*Engine VDB object to be written.contentType
- The MIME content type to associate with the request.
Currently accepts text/xml or
application/java-serialized-object. If null,
will use text/xml.exception
- States whether this VDB is the result of an exception
or not. If true the MIME part for the VDB will be named
"exception". If false the MIME part will be named "object".
IOException
- if the request object is not written
successfully.public void print(String data) throws IOException
data
- The string to be written.
IOException
- if the string is not written successfully.public void println(String data) throws IOException
data
- The string to be written.
IOException
- if the string is not written successfully.public void writeEOF() throws IOException
IOException
- if the string is not written successfully.public boolean eofWritten()
protected void initialize(String contentType, int contentLength, String boundary) throws IOException
IOException
protected void initialize(String contentType, String boundary) throws IOException
IOException
private void writeDisposition(String name, String filename) throws IOException
IOException
private boolean isUsASCII(String s)
private void writeContentType(String contentType) throws IOException
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |