* Write the instance to a stream (ie serialize the object).
*/
private void writeObject(ObjectOutputStream s) throws IOException {
s.defaultWriteObject();
s.writeObject(myMimeType.getMimeType());
}
/**
* Reconstitute an instance from a stream (that is, deserialize it).
*
* @serialData
* The serialised form of a DocFlavor is the String naming the
* representation class followed by the String representing the canonical
* form of the mime type.
*/
private void readObject(ObjectInputStream s)
throws ClassNotFoundException, IOException {
s.defaultReadObject();
myMimeType = new MimeType((String)s.readObject());
}
/**
* Class DocFlavor.BYTE_ARRAY provides predefined static constant
* DocFlavor objects for example doc flavors using a byte array
* (<CODE>byte[]</CODE>) as the print data representation class.
* <P>
*
* @author Alan Kaminsky
*/
public static class BYTE_ARRAY extends DocFlavor {
private static final long serialVersionUID = -9065578006593857475L;
/**
* Constructs a new doc flavor with the given MIME type and a print
* data representation class name of <CODE>"[B"</CODE> (byte array).
*
* @param mimeType MIME media type string.
*
* @exception NullPointerException
* (unchecked exception) Thrown if <CODE>mimeType</CODE> is null.
* @exception IllegalArgumentException
* (unchecked exception) Thrown if <CODE>mimeType</CODE> does not
* obey the syntax for a MIME media type string.
*/
public BYTE_ARRAY (String mimeType) {
super (mimeType, "[B");
}
/**
* Doc flavor with MIME type = <CODE>"text/plain"</CODE>,
* encoded in the host platform encoding.
* See {@link DocFlavor#hostEncoding <CODE>hostEncoding</CODE>}
* Print data representation class name =
* <CODE>"[B"</CODE> (byte array).
*/
public static final BYTE_ARRAY TEXT_PLAIN_HOST =
new BYTE_ARRAY ("text/plain; charset="+hostEncoding);
/**
* Doc flavor with MIME type =
* <CODE>"text/plain; charset=utf-8"</CODE>,
* print data representation class name = <CODE>"[B"</CODE> (byte
* array).
*/
public static final BYTE_ARRAY TEXT_PLAIN_UTF_8 =
new BYTE_ARRAY ("text/plain; charset=utf-8");
/**
* Doc flavor with MIME type =
* <CODE>"text/plain; charset=utf-16"</CODE>,
* print data representation class name = <CODE>"[B"</CODE> (byte
* array).
*/
public static final BYTE_ARRAY TEXT_PLAIN_UTF_16 =
new BYTE_ARRAY ("text/plain; charset=utf-16");
/**
* Doc flavor with MIME type =
* <CODE>"text/plain; charset=utf-16be"</CODE>
* (big-endian byte ordering),
* print data representation class name = <CODE>"[B"</CODE> (byte
* array).
*/
public static final BYTE_ARRAY TEXT_PLAIN_UTF_16BE =
new BYTE_ARRAY ("text/plain; charset=utf-16be");
/**
* Doc flavor with MIME type =
* <CODE>"text/plain; charset=utf-16le"</CODE>
* (little-endian byte ordering),
* print data representation class name = <CODE>"[B"</CODE> (byte
* array).
*/
public static final BYTE_ARRAY TEXT_PLAIN_UTF_16LE =
new BYTE_ARRAY ("text/plain; charset=utf-16le");
=7= |