0N/A/*
3261N/A * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.print;
0N/A
0N/Aimport java.io.IOException;
0N/Aimport java.io.ObjectInputStream;
0N/Aimport java.io.ObjectOutputStream;
0N/Aimport java.io.Serializable;
0N/A
0N/A
0N/A/**
0N/A * Class <code>DocFlavor</code> encapsulates an object that specifies the
0N/A * format in which print data is supplied to a {@link DocPrintJob}.
0N/A * "Doc" is a short, easy-to-pronounce term that means "a piece of print data."
0N/A * The print data format, or "doc flavor", consists of two things:
0N/A * <UL>
0N/A * <LI>
0N/A * <B>MIME type.</B> This is a Multipurpose Internet Mail Extensions (MIME)
0N/A * media type (as defined in <A HREF="http://www.ietf.org/rfc/rfc2045.txt">RFC
0N/A * 2045</A> and <A HREF="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</A>)
0N/A * that specifies how the print data is to be interpreted.
0N/A * The charset of text data should be the IANA MIME-preferred name, or its
0N/A * canonical name if no preferred name is specified. Additionally a few
0N/A * historical names supported by earlier versions of the Java platform may
0N/A * be recognized.
0N/A * See <a href="../../java/lang/package-summary.html#charenc">
0N/A * character encodings</a> for more information on the character encodings
0N/A * supported on the Java platform.
0N/A * <P>
0N/A * <LI>
0N/A * <B>Representation class name.</B> This specifies the fully-qualified name of
0N/A * the class of the object from which the actual print data comes, as returned
0N/A * by the {@link java.lang.Class#getName() <CODE>Class.getName()</CODE>} method.
0N/A * (Thus the class name for <CODE>byte[]</CODE> is <CODE>"[B"</CODE>, for
0N/A * <CODE>char[]</CODE> it is <CODE>"[C"</CODE>.)
0N/A * </UL>
0N/A * <P>
0N/A * A <code>DocPrintJob</code> obtains its print data by means of interface
0N/A * {@link Doc Doc}. A <code>Doc</code> object lets the <code>DocPrintJob</code>
0N/A * determine the doc flavor the client can supply. A <code>Doc</code> object
0N/A * also lets the <code>DocPrintJob</code> obtain an instance of the doc flavor's
0N/A * representation class, from which the <code>DocPrintJob</code> then obtains
0N/A * the actual print data.
0N/A * <P>
0N/A * <HR>
0N/A * <H3>Client Formatted Print Data</H3>
0N/A * There are two broad categories of print data, client formatted print data
0N/A * and service formatted print data.
0N/A * <P>
0N/A * For <B>client formatted print data</B>, the client determines or knows the
0N/A * print data format.
0N/A * For example the client may have a JPEG encoded image, a URL for
0N/A * HTML code, or a disk file containing plain text in some encoding,
0N/A * possibly obtained from an external source, and
0N/A * requires a way to describe the data format to the print service.
0N/A * <p>
0N/A * The doc flavor's representation class is a conduit for the JPS
0N/A * <code>DocPrintJob</code> to obtain a sequence of characters or
0N/A * bytes from the client. The
0N/A * doc flavor's MIME type is one of the standard media types telling how to
0N/A * interpret the sequence of characters or bytes. For a list of standard media
0N/A * types, see the Internet Assigned Numbers Authority's (IANA's) <A
2395N/A * HREF="http://www.iana.org/assignments/media-types/">Media Types
0N/A * Directory</A>. Interface {@link Doc Doc} provides two utility operations,
0N/A * {@link Doc#getReaderForText() getReaderForText} and
0N/A * {@link Doc#getStreamForBytes() getStreamForBytes()}, to help a
0N/A * <code>Doc</code> object's client extract client formatted print data.
0N/A * <P>
0N/A * For client formatted print data, the print data representation class is
0N/A * typically one of the following (although other representation classes are
0N/A * permitted):
0N/A * <UL>
0N/A * <LI>
0N/A * Character array (<CODE>char[]</CODE>) -- The print data consists of the
0N/A * Unicde characters in the array.
0N/A * <P>
0N/A * <LI>
0N/A * <code>String</code> --
0N/A * The print data consists of the Unicode characters in the string.
0N/A * <P>
0N/A * <LI>
0N/A * Character stream ({@link java.io.Reader java.io.Reader})
0N/A * -- The print data consists of the Unicode characters read from the stream
0N/A * up to the end-of-stream.
0N/A * <P>
0N/A * <LI>
0N/A * Byte array (<CODE>byte[]</CODE>) -- The print data consists of the bytes in
0N/A * the array. The bytes are encoded in the character set specified by the doc
0N/A * flavor's MIME type. If the MIME type does not specify a character set, the
0N/A * default character set is US-ASCII.
0N/A * <P>
0N/A * <LI>
0N/A * Byte stream ({@link java.io.InputStream java.io.InputStream}) --
0N/A * The print data consists of the bytes read from the stream up to the
0N/A * end-of-stream. The bytes are encoded in the character set specified by the
0N/A * doc flavor's MIME type. If the MIME type does not specify a character set,
0N/A * the default character set is US-ASCII.
0N/A
0N/A * <LI>
0N/A * Uniform Resource Locator ({@link java.net.URL URL})
0N/A * -- The print data consists of the bytes read from the URL location.
0N/A * The bytes are encoded in the character set specified by the doc flavor's
0N/A * MIME type. If the MIME type does not specify a character set, the default
0N/A * character set is US-ASCII.
0N/A * <P>
0N/A * When the representation class is a URL, the print service itself accesses
0N/A * and downloads the document directly from its URL address, without involving
0N/A * the client. The service may be some form of network print service which
0N/A * is executing in a different environment.
0N/A * This means you should not use a URL print data flavor to print a
0N/A * document at a restricted URL that the client can see but the printer cannot
0N/A * see. This also means you should not use a URL print data flavor to print a
0N/A * document stored in a local file that is not available at a URL
0N/A * accessible independently of the client.
0N/A * For example, a file that is not served up by an HTTP server or FTP server.
0N/A * To print such documents, let the client open an input stream on the URL
0N/A * or file and use an input stream data flavor.
0N/A * </UL>
0N/A * <p>
0N/A * <HR>
0N/A * <h3>Default and Platform Encodings</h3>
0N/A * <P>
0N/A * For byte print data where the doc flavor's MIME type does not include a
0N/A * <CODE>charset</CODE> parameter, the Java Print Service instance assumes the
0N/A * US-ASCII character set by default. This is in accordance with
0N/A * <A HREF="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</A>, which says the
0N/A * default character set is US-ASCII. Note that US-ASCII is a subset of
0N/A * UTF-8, so in the future this may be widened if a future RFC endorses
0N/A * UTF-8 as the default in a compatible manner.
0N/A * <p>
0N/A * Also note that this is different than the behaviour of the Java runtime
0N/A * when interpreting a stream of bytes as text data. That assumes the
0N/A * default encoding for the user's locale. Thus, when spooling a file in local
0N/A * encoding to a Java Print Service it is important to correctly specify
0N/A * the encoding. Developers working in the English locales should
0N/A * be particularly conscious of this, as their platform encoding corresponds
0N/A * to the default mime charset. By this coincidence that particular
0N/A * case may work without specifying the encoding of platform data.
0N/A * <p>
0N/A * Every instance of the Java virtual machine has a default character encoding
0N/A * determined during virtual-machine startup and typically depends upon the
0N/A * locale and charset being used by the underlying operating system.
0N/A * In a distributed environment there is no gurantee that two VM's share
0N/A * the same default encoding. Thus clients which want to stream platform
0N/A * encoded text data from the host platform to a Java Print Service instance
0N/A * must explicitly declare the charset and not rely on defaults.
0N/A * <p>
0N/A * The preferred form is the official IANA primary name for an encoding.
0N/A * Applications which stream text data should always specify the charset
0N/A * in the mime type, which necessitates obtaining the encoding of the host
0N/A * platform for data (eg files) stored in that platform's encoding.
0N/A * A CharSet which corresponds to this and is suitable for use in a
0N/A * mime-type for a DocFlavor can be obtained
0N/A * from {@link DocFlavor#hostEncoding <CODE>DocFlavor.hostEncoding</CODE>}
0N/A * This may not always be the primary IANA name but is guaranteed to be
0N/A * understood by this VM.
0N/A * For common flavors, the pre-defined *HOST DocFlavors may be used.
0N/A * <p>
0N/A * <p>
0N/A * See <a href="../../java/lang/package-summary.html#charenc">
0N/A * character encodings</a> for more information on the character encodings
0N/A * supported on the Java platform.
0N/A * <p>
0N/A * <HR>
0N/A * <h3>Recommended DocFlavors</h3>
0N/A * <P>
0N/A * The Java Print Service API does not define any mandatorily supported
0N/A * DocFlavors.
0N/A * However, here are some examples of MIME types that a Java Print Service
0N/A * instance might support for client formatted print data.
0N/A * Nested classes inside class DocFlavor declare predefined static
0N/A * constant DocFlavor objects for these example doc flavors; class DocFlavor's
0N/A * constructor can be used to create an arbitrary doc flavor.
0N/A * <UL>
0N/A * <LI>Preformatted text
0N/A * <P>
0N/A * <TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 SUMMARY="MIME-Types and their descriptions">
0N/A * <TR>
0N/A * <TH>MIME-Type</TH><TH>Description</TH>
0N/A * </TR>
0N/A * <TR>
0N/A * <TD><CODE>"text/plain"</CODE></TD>
0N/A * <TD>Plain text in the default character set (US-ASCII)</TD>
0N/A * </TR>
0N/A * <TR>
0N/A * <TD><CODE>"text/plain; charset=<I>xxx</I>"</CODE></TD>
0N/A * <TD>Plain text in character set <I>xxx</I></TD>
0N/A * </TR>
0N/A * <TR>
0N/A * <TD><CODE>"text/html"</CODE></TD>
0N/A * <TD>HyperText Markup Language in the default character set (US-ASCII)</TD>
0N/A * </TR>
0N/A * <TR>
0N/A * <TD><CODE>"text/html; charset=<I>xxx</I>"</CODE></TD>
0N/A * <TD>HyperText Markup Language in character set <I>xxx</I></TD>
0N/A * </TR>
0N/A * </TABLE>
0N/A * <P>
0N/A * In general, preformatted text print data is provided either in a character
0N/A * oriented representation class (character array, String, Reader) or in a
0N/A * byte oriented representation class (byte array, InputStream, URL).
0N/A * <P>
0N/A * <LI>Preformatted page description language (PDL) documents
0N/A *<P>
0N/A * <TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 SUMMARY="MIME-Types and their descriptions">
0N/A * <TR>
0N/A * <TH>MIME-Type</TH><TH>Description</TH>
0N/A * </TR>
0N/A *<TR>
0N/A * <TD><CODE>"application/pdf"</CODE></TD>
0N/A * <TD>Portable Document Format document</TD>
0N/A * </TR>
0N/A * <TR>
0N/A * <TD><CODE>"application/postscript"</CODE></TD>
0N/A * <TD>PostScript document</TD>
0N/A * </TR>
0N/A * <TR>
0N/A * <TD><CODE>"application/vnd.hp-PCL"</CODE></TD>
0N/A * <TD>Printer Control Language document</TD>
0N/A * </TR>
0N/A * </TABLE>
0N/A * <P>
0N/A * In general, preformatted PDL print data is provided in a byte oriented
0N/A * representation class (byte array, InputStream, URL).
0N/A * <P>
0N/A * <LI>Preformatted images
0N/A *<P>
0N/A * <TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 SUMMARY="MIME-Types and their descriptions">
0N/A * <TR>
0N/A * <TH>MIME-Type</TH><TH>Description</TH>
0N/A * </TR>
0N/A *
0N/A * <TR>
0N/A * <TD><CODE>"image/gif"</CODE></TD>
0N/A * <TD>Graphics Interchange Format image</TD>
0N/A * </TR>
0N/A * <TR>
0N/A * <TD><CODE>"image/jpeg"</CODE></TD>
0N/A * <TD>Joint Photographic Experts Group image</TD>
0N/A * </TR>
0N/A * <TR>
0N/A * <TD><CODE>"image/png"</CODE></TD>
0N/A * <TD>Portable Network Graphics image</TD>
0N/A * </TR>
0N/A * </TABLE>
0N/A * <P>
0N/A * In general, preformatted image print data is provided in a byte oriented
0N/A * representation class (byte array, InputStream, URL).
0N/A * <P>
0N/A * <LI>Preformatted autosense print data
0N/A * <P>
0N/A * <TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 SUMMARY="MIME-Types and their descriptions">
0N/A * <TR>
0N/A * <TH>MIME-Type</TH><TH>Description</TH>
0N/A * </TR>
0N/A *
0N/A * <TR>
0N/A * <TD><CODE>"application/octet-stream"</CODE></TD>
0N/A * <TD>The print data format is unspecified (just an octet stream)</TD>
0N/A * </TABLE>
0N/A * <P>
0N/A * The printer decides how to interpret the print data; the way this
0N/A * "autosensing" works is implementation dependent. In general, preformatted
0N/A * autosense print data is provided in a byte oriented representation class
0N/A * (byte array, InputStream, URL).
0N/A *
0N/A * <P>
0N/A * <HR>
0N/A * <H3>Service Formatted Print Data</H3>
0N/A * <P>
0N/A * For <B>service formatted print data</B>, the Java Print Service instance
0N/A * determines the print data format. The doc flavor's representation class
0N/A * denotes an interface whose methods the <code>DocPrintJob</code> invokes to
0N/A * determine the content to be printed -- such as a renderable image
0N/A * interface or a Java printable interface.
0N/A * The doc flavor's MIME type is the special value
0N/A * <CODE>"application/x-java-jvm-local-objectref"</CODE> indicating the client
0N/A * will supply a reference to a Java object that implements the interface
0N/A * named as the representation class.
0N/A * This MIME type is just a placeholder; what's
0N/A * important is the print data representation class.
0N/A * <P>
0N/A * For service formatted print data, the print data representation class is
0N/A * typically one of the following (although other representation classes are
0N/A * permitted). Nested classes inside class DocFlavor declare predefined static
0N/A * constant DocFlavor objects for these example doc flavors; class DocFlavor's
0N/A * constructor can be used to create an arbitrary doc flavor.
0N/A * <UL>
0N/A * <LI>
0N/A * Renderable image object -- The client supplies an object that implements
0N/A * interface
0N/A * {@link java.awt.image.renderable.RenderableImage RenderableImage}. The
0N/A * printer calls methods
0N/A * in that interface to obtain the image to be printed.
0N/A * <P>
0N/A * <LI>
0N/A * Printable object -- The client supplies an object that implements interface
0N/A * {@link java.awt.print.Printable Printable}.
0N/A * The printer calls methods in that interface to obtain the pages to be
0N/A * printed, one by one.
0N/A * For each page, the printer supplies a graphics context, and whatever the
0N/A * client draws in that graphics context gets printed.
0N/A * <P>
0N/A * <LI>
0N/A * Pageable object -- The client supplies an object that implements interface
0N/A * {@link java.awt.print.Pageable Pageable}. The printer calls
0N/A * methods in that interface to obtain the pages to be printed, one by one.
0N/A * For each page, the printer supplies a graphics context, and whatever
0N/A * the client draws in that graphics context gets printed.
0N/A * </UL>
0N/A * <P>
0N/A * <HR>
0N/A * <P>
0N/A * <HR>
0N/A * <H3>Pre-defined Doc Flavors</H3>
0N/A * A Java Print Service instance is not <B><I>required</I></B> to support the
0N/A * following print data formats and print data representation classes. In
0N/A * fact, a developer using this class should <b>never</b> assume that a
0N/A * particular print service supports the document types corresponding to
0N/A * these pre-defined doc flavors. Always query the print service
0N/A * to determine what doc flavors it supports. However,
0N/A * developers who have print services that support these doc flavors are
0N/A * encouraged to refer to the predefined singleton instances created here.
0N/A * <UL>
0N/A * <LI>
0N/A * Plain text print data provided through a byte stream. Specifically, the
0N/A * following doc flavors are recommended to be supported:
0N/A * <BR>&#183;&nbsp;&nbsp;
0N/A * <CODE>("text/plain", "java.io.InputStream")</CODE>
0N/A * <BR>&#183;&nbsp;&nbsp;
0N/A * <CODE>("text/plain; charset=us-ascii", "java.io.InputStream")</CODE>
0N/A * <BR>&#183;&nbsp;&nbsp;
0N/A * <CODE>("text/plain; charset=utf-8", "java.io.InputStream")</CODE>
0N/A * <P>
0N/A * <LI>
0N/A * Renderable image objects. Specifically, the following doc flavor is
0N/A * recommended to be supported:
0N/A * <BR>&#183;&nbsp;&nbsp;
0N/A * <CODE>("application/x-java-jvm-local-objectref", "java.awt.image.renderable.RenderableImage")</CODE>
0N/A * </UL>
0N/A * <P>
0N/A * A Java Print Service instance is allowed to support any other doc flavors
0N/A * (or none) in addition to the above mandatory ones, at the implementation's
0N/A * choice.
0N/A * <P>
0N/A * Support for the above doc flavors is desirable so a printing client can rely
0N/A * on being able to print on any JPS printer, regardless of which doc flavors
0N/A * the printer supports. If the printer doesn't support the client's preferred
0N/A * doc flavor, the client can at least print plain text, or the client can
0N/A * convert its data to a renderable image and print the image.
0N/A * <P>
0N/A * Furthermore, every Java Print Service instance must fulfill these
0N/A * requirements for processing plain text print data:
0N/A * <UL>
0N/A * <LI>
0N/A * The character pair carriage return-line feed (CR-LF) means
0N/A * "go to column 1 of the next line."
0N/A * <LI>
0N/A * A carriage return (CR) character standing by itself means
0N/A * "go to column 1 of the next line."
0N/A * <LI>
0N/A * A line feed (LF) character standing by itself means
0N/A * "go to column 1 of the next line."
0N/A * <LI>
0N/A * </UL>
0N/A * <P>
0N/A * The client must itself perform all plain text print data formatting not
0N/A * addressed by the above requirements.
0N/A * <P>
0N/A * <H3>Design Rationale</H3>
0N/A * <P>
0N/A * Class DocFlavor in package javax.print.data is similar to class
0N/A * {@link java.awt.datatransfer.DataFlavor DataFlavor}. Class
0N/A * <code>DataFlavor</code>
0N/A * is not used in the Java Print Service (JPS) API
0N/A * for three reasons which are all rooted in allowing the JPS API to be
0N/A * shared by other print services APIs which may need to run on Java profiles
0N/A * which do not include all of the Java Platform, Standard Edition.
0N/A * <OL TYPE=1>
0N/A * <LI>
0N/A * The JPS API is designed to be used in Java profiles which do not support
0N/A * AWT.
0N/A * <P>
0N/A * <LI>
0N/A * The implementation of class <code>java.awt.datatransfer.DataFlavor</code>
0N/A * does not guarantee that equivalent data flavors will have the same
0N/A * serialized representation. DocFlavor does, and can be used in services
0N/A * which need this.
0N/A * <P>
0N/A * <LI>
0N/A * The implementation of class <code>java.awt.datatransfer.DataFlavor</code>
0N/A * includes a human presentable name as part of the serialized representation.
0N/A * This is not appropriate as part of a service matching constraint.
0N/A * </OL>
0N/A * <P>
0N/A * Class DocFlavor's serialized representation uses the following
0N/A * canonical form of a MIME type string. Thus, two doc flavors with MIME types
0N/A * that are not identical but that are equivalent (that have the same
0N/A * canonical form) may be considered equal.
0N/A * <UL>
0N/A * <LI> The media type, media subtype, and parameters are retained, but all
0N/A * comments and whitespace characters are discarded.
0N/A * <LI> The media type, media subtype, and parameter names are converted to
0N/A * lowercase.
0N/A * <LI> The parameter values retain their original case, except a charset
0N/A * parameter value for a text media type is converted to lowercase.
0N/A * <LI> Quote characters surrounding parameter values are removed.
0N/A * <LI> Quoting backslash characters inside parameter values are removed.
0N/A * <LI> The parameters are arranged in ascending order of parameter name.
0N/A * </UL>
0N/A * <P>
0N/A * Class DocFlavor's serialized representation also contains the
0N/A * fully-qualified class <I>name</I> of the representation class
0N/A * (a String object), rather than the representation class itself
0N/A * (a Class object). This allows a client to examine the doc flavors a
0N/A * Java Print Service instance supports without having
0N/A * to load the representation classes, which may be problematic for
0N/A * limited-resource clients.
0N/A * <P>
0N/A *
0N/A * @author Alan Kaminsky
0N/A */
0N/Apublic class DocFlavor implements Serializable, Cloneable {
0N/A
0N/A private static final long serialVersionUID = -4512080796965449721L;
0N/A
0N/A /**
0N/A * A String representing the host operating system encoding.
0N/A * This will follow the conventions documented in
2507N/A * <a href="http://www.ietf.org/rfc/rfc2278.txt">
0N/A * <i>RFC&nbsp;2278:&nbsp;IANA Charset Registration Procedures</i></a>
0N/A * except where historical names are returned for compatibility with
0N/A * previous versions of the Java platform.
0N/A * The value returned from method is valid only for the VM which
0N/A * returns it, for use in a DocFlavor.
0N/A * This is the charset for all the "HOST" pre-defined DocFlavors in
0N/A * the executing VM.
0N/A */
0N/A public static final String hostEncoding;
0N/A
0N/A static {
0N/A hostEncoding =
0N/A (String)java.security.AccessController.doPrivileged(
0N/A new sun.security.action.GetPropertyAction("file.encoding"));
0N/A }
0N/A
0N/A /**
0N/A * MIME type.
0N/A */
0N/A private transient MimeType myMimeType;
0N/A
0N/A /**
0N/A * Representation class name.
0N/A * @serial
0N/A */
0N/A private String myClassName;
0N/A
0N/A /**
0N/A * String value for this doc flavor. Computed when needed and cached.
0N/A */
0N/A private transient String myStringValue = null;
0N/A
0N/A
0N/A /**
0N/A * Constructs a new doc flavor object from the given MIME type and
0N/A * representation class name. The given MIME type is converted into
0N/A * canonical form and stored internally.
0N/A *
0N/A * @param mimeType MIME media type string.
0N/A * @param className Fully-qualified representation class name.
0N/A *
0N/A * @exception NullPointerException
0N/A * (unchecked exception) Thrown if <CODE>mimeType</CODE> is null or
0N/A * <CODE>className</CODE> is null.
0N/A * @exception IllegalArgumentException
0N/A * (unchecked exception) Thrown if <CODE>mimeType</CODE> does not
0N/A * obey the syntax for a MIME media type string.
0N/A */
0N/A public DocFlavor(String mimeType, String className) {
0N/A if (className == null) {
0N/A throw new NullPointerException();
0N/A }
0N/A myMimeType = new MimeType (mimeType);
0N/A myClassName = className;
0N/A }
0N/A
0N/A /**
0N/A * Returns this doc flavor object's MIME type string based on the
0N/A * canonical form. Each parameter value is enclosed in quotes.
0N/A * @return the mime type
0N/A */
0N/A public String getMimeType() {
0N/A return myMimeType.getMimeType();
0N/A }
0N/A
0N/A /**
0N/A * Returns this doc flavor object's media type (from the MIME type).
0N/A * @return the media type
0N/A */
0N/A public String getMediaType() {
0N/A return myMimeType.getMediaType();
0N/A }
0N/A
0N/A /**
0N/A * Returns this doc flavor object's media subtype (from the MIME type).
0N/A * @return the media sub-type
0N/A */
0N/A public String getMediaSubtype() {
0N/A return myMimeType.getMediaSubtype();
0N/A }
0N/A
0N/A /**
0N/A * Returns a <code>String</code> representing a MIME
0N/A * parameter.
0N/A * Mime types may include parameters which are usually optional.
0N/A * The charset for text types is a commonly useful example.
0N/A * This convenience method will return the value of the specified
0N/A * parameter if one was specified in the mime type for this flavor.
0N/A * <p>
0N/A * @param paramName the name of the paramater. This name is internally
0N/A * converted to the canonical lower case format before performing
0N/A * the match.
0N/A * @return String representing a mime parameter, or
0N/A * null if that parameter is not in the mime type string.
0N/A * @exception throws NullPointerException if paramName is null.
0N/A */
0N/A public String getParameter(String paramName) {
0N/A return
0N/A (String)myMimeType.getParameterMap().get(paramName.toLowerCase());
0N/A }
0N/A
0N/A /**
0N/A * Returns the name of this doc flavor object's representation class.
0N/A * @return the name of the representation class.
0N/A */
0N/A public String getRepresentationClassName() {
0N/A return myClassName;
0N/A }
0N/A
0N/A /**
0N/A * Converts this <code>DocFlavor</code> to a string.
0N/A *
0N/A * @return MIME type string based on the canonical form. Each parameter
0N/A * value is enclosed in quotes.
0N/A * A "class=" parameter is appended to the
0N/A * MIME type string to indicate the representation class name.
0N/A */
0N/A public String toString() {
0N/A return getStringValue();
0N/A }
0N/A
0N/A /**
0N/A * Returns a hash code for this doc flavor object.
0N/A */
0N/A public int hashCode() {
0N/A return getStringValue().hashCode();
0N/A }
0N/A
0N/A /**
0N/A * Determines if this doc flavor object is equal to the given object.
0N/A * The two are equal if the given object is not null, is an instance
0N/A * of <code>DocFlavor</code>, has a MIME type equivalent to this doc
0N/A * flavor object's MIME type (that is, the MIME types have the same media
0N/A * type, media subtype, and parameters), and has the same representation
0N/A * class name as this doc flavor object. Thus, if two doc flavor objects'
0N/A * MIME types are the same except for comments, they are considered equal.
0N/A * However, two doc flavor objects with MIME types of "text/plain" and
0N/A * "text/plain; charset=US-ASCII" are not considered equal, even though
0N/A * they represent the same media type (because the default character
0N/A * set for plain text is US-ASCII).
0N/A *
0N/A * @param obj Object to test.
0N/A *
0N/A * @return True if this doc flavor object equals <CODE>obj</CODE>, false
0N/A * otherwise.
0N/A */
0N/A public boolean equals(Object obj) {
0N/A return
0N/A obj != null &&
0N/A obj instanceof DocFlavor &&
0N/A getStringValue().equals (((DocFlavor) obj).getStringValue());
0N/A }
0N/A
0N/A /**
0N/A * Returns this doc flavor object's string value.
0N/A */
0N/A private String getStringValue() {
0N/A if (myStringValue == null) {
0N/A myStringValue = myMimeType + "; class=\"" + myClassName + "\"";
0N/A }
0N/A return myStringValue;
0N/A }
0N/A
0N/A /**
0N/A * Write the instance to a stream (ie serialize the object).
0N/A */
0N/A private void writeObject(ObjectOutputStream s) throws IOException {
0N/A
0N/A s.defaultWriteObject();
0N/A s.writeObject(myMimeType.getMimeType());
0N/A }
0N/A
0N/A /**
0N/A * Reconstitute an instance from a stream (that is, deserialize it).
0N/A *
0N/A * @serialData
0N/A * The serialised form of a DocFlavor is the String naming the
0N/A * representation class followed by the String representing the canonical
0N/A * form of the mime type.
0N/A */
0N/A private void readObject(ObjectInputStream s)
0N/A throws ClassNotFoundException, IOException {
0N/A
0N/A s.defaultReadObject();
0N/A myMimeType = new MimeType((String)s.readObject());
0N/A }
0N/A
0N/A /**
0N/A * Class DocFlavor.BYTE_ARRAY provides predefined static constant
0N/A * DocFlavor objects for example doc flavors using a byte array
0N/A * (<CODE>byte[]</CODE>) as the print data representation class.
0N/A * <P>
0N/A *
0N/A * @author Alan Kaminsky
0N/A */
0N/A public static class BYTE_ARRAY extends DocFlavor {
0N/A
0N/A private static final long serialVersionUID = -9065578006593857475L;
0N/A
0N/A /**
0N/A * Constructs a new doc flavor with the given MIME type and a print
0N/A * data representation class name of <CODE>"[B"</CODE> (byte array).
0N/A *
0N/A * @param mimeType MIME media type string.
0N/A *
0N/A * @exception NullPointerException
0N/A * (unchecked exception) Thrown if <CODE>mimeType</CODE> is null.
0N/A * @exception IllegalArgumentException
0N/A * (unchecked exception) Thrown if <CODE>mimeType</CODE> does not
0N/A * obey the syntax for a MIME media type string.
0N/A */
0N/A public BYTE_ARRAY (String mimeType) {
0N/A super (mimeType, "[B");
0N/A }
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"text/plain"</CODE>,
0N/A * encoded in the host platform encoding.
0N/A * See {@link DocFlavor#hostEncoding <CODE>hostEncoding</CODE>}
0N/A * Print data representation class name =
0N/A * <CODE>"[B"</CODE> (byte array).
0N/A */
0N/A public static final BYTE_ARRAY TEXT_PLAIN_HOST =
0N/A new BYTE_ARRAY ("text/plain; charset="+hostEncoding);
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/plain; charset=utf-8"</CODE>,
0N/A * print data representation class name = <CODE>"[B"</CODE> (byte
0N/A * array).
0N/A */
0N/A public static final BYTE_ARRAY TEXT_PLAIN_UTF_8 =
0N/A new BYTE_ARRAY ("text/plain; charset=utf-8");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/plain; charset=utf-16"</CODE>,
0N/A * print data representation class name = <CODE>"[B"</CODE> (byte
0N/A * array).
0N/A */
0N/A public static final BYTE_ARRAY TEXT_PLAIN_UTF_16 =
0N/A new BYTE_ARRAY ("text/plain; charset=utf-16");
0N/A
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/plain; charset=utf-16be"</CODE>
0N/A * (big-endian byte ordering),
0N/A * print data representation class name = <CODE>"[B"</CODE> (byte
0N/A * array).
0N/A */
0N/A public static final BYTE_ARRAY TEXT_PLAIN_UTF_16BE =
0N/A new BYTE_ARRAY ("text/plain; charset=utf-16be");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/plain; charset=utf-16le"</CODE>
0N/A * (little-endian byte ordering),
0N/A * print data representation class name = <CODE>"[B"</CODE> (byte
0N/A * array).
0N/A */
0N/A public static final BYTE_ARRAY TEXT_PLAIN_UTF_16LE =
0N/A new BYTE_ARRAY ("text/plain; charset=utf-16le");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/plain; charset=us-ascii"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"[B"</CODE> (byte array).
0N/A */
0N/A public static final BYTE_ARRAY TEXT_PLAIN_US_ASCII =
0N/A new BYTE_ARRAY ("text/plain; charset=us-ascii");
0N/A
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"text/html"</CODE>,
0N/A * encoded in the host platform encoding.
0N/A * See {@link DocFlavor#hostEncoding <CODE>hostEncoding</CODE>}
0N/A * Print data representation class name =
0N/A * <CODE>"[B"</CODE> (byte array).
0N/A */
0N/A public static final BYTE_ARRAY TEXT_HTML_HOST =
0N/A new BYTE_ARRAY ("text/html; charset="+hostEncoding);
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/html; charset=utf-8"</CODE>,
0N/A * print data representation class name = <CODE>"[B"</CODE> (byte
0N/A * array).
0N/A */
0N/A public static final BYTE_ARRAY TEXT_HTML_UTF_8 =
0N/A new BYTE_ARRAY ("text/html; charset=utf-8");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/html; charset=utf-16"</CODE>,
0N/A * print data representation class name = <CODE>"[B"</CODE> (byte
0N/A * array).
0N/A */
0N/A public static final BYTE_ARRAY TEXT_HTML_UTF_16 =
0N/A new BYTE_ARRAY ("text/html; charset=utf-16");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/html; charset=utf-16be"</CODE>
0N/A * (big-endian byte ordering),
0N/A * print data representation class name = <CODE>"[B"</CODE> (byte
0N/A * array).
0N/A */
0N/A public static final BYTE_ARRAY TEXT_HTML_UTF_16BE =
0N/A new BYTE_ARRAY ("text/html; charset=utf-16be");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/html; charset=utf-16le"</CODE>
0N/A * (little-endian byte ordering),
0N/A * print data representation class name = <CODE>"[B"</CODE> (byte
0N/A * array).
0N/A */
0N/A public static final BYTE_ARRAY TEXT_HTML_UTF_16LE =
0N/A new BYTE_ARRAY ("text/html; charset=utf-16le");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/html; charset=us-ascii"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"[B"</CODE> (byte array).
0N/A */
0N/A public static final BYTE_ARRAY TEXT_HTML_US_ASCII =
0N/A new BYTE_ARRAY ("text/html; charset=us-ascii");
0N/A
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"application/pdf"</CODE>, print
0N/A * data representation class name = <CODE>"[B"</CODE> (byte array).
0N/A */
0N/A public static final BYTE_ARRAY PDF = new BYTE_ARRAY ("application/pdf");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"application/postscript"</CODE>,
0N/A * print data representation class name = <CODE>"[B"</CODE> (byte
0N/A * array).
0N/A */
0N/A public static final BYTE_ARRAY POSTSCRIPT =
0N/A new BYTE_ARRAY ("application/postscript");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"application/vnd.hp-PCL"</CODE>,
0N/A * print data representation class name = <CODE>"[B"</CODE> (byte
0N/A * array).
0N/A */
0N/A public static final BYTE_ARRAY PCL =
0N/A new BYTE_ARRAY ("application/vnd.hp-PCL");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"image/gif"</CODE>, print data
0N/A * representation class name = <CODE>"[B"</CODE> (byte array).
0N/A */
0N/A public static final BYTE_ARRAY GIF = new BYTE_ARRAY ("image/gif");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"image/jpeg"</CODE>, print data
0N/A * representation class name = <CODE>"[B"</CODE> (byte array).
0N/A */
0N/A public static final BYTE_ARRAY JPEG = new BYTE_ARRAY ("image/jpeg");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"image/png"</CODE>, print data
0N/A * representation class name = <CODE>"[B"</CODE> (byte array).
0N/A */
0N/A public static final BYTE_ARRAY PNG = new BYTE_ARRAY ("image/png");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"application/octet-stream"</CODE>,
0N/A * print data representation class name = <CODE>"[B"</CODE> (byte
0N/A * array). The client must determine that data described
0N/A * using this DocFlavor is valid for the printer.
0N/A */
0N/A public static final BYTE_ARRAY AUTOSENSE =
0N/A new BYTE_ARRAY ("application/octet-stream");
0N/A
0N/A }
0N/A
0N/A /**
0N/A * Class DocFlavor.INPUT_STREAM provides predefined static constant
0N/A * DocFlavor objects for example doc flavors using a byte stream ({@link
0N/A * java.io.InputStream <CODE>java.io.InputStream</CODE>}) as the print
0N/A * data representation class.
0N/A * <P>
0N/A *
0N/A * @author Alan Kaminsky
0N/A */
0N/A public static class INPUT_STREAM extends DocFlavor {
0N/A
0N/A private static final long serialVersionUID = -7045842700749194127L;
0N/A
0N/A /**
0N/A * Constructs a new doc flavor with the given MIME type and a print
0N/A * data representation class name of
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A *
0N/A * @param mimeType MIME media type string.
0N/A *
0N/A * @exception NullPointerException
0N/A * (unchecked exception) Thrown if <CODE>mimeType</CODE> is null.
0N/A * @exception IllegalArgumentException
0N/A * (unchecked exception) Thrown if <CODE>mimeType</CODE> does not
0N/A * obey the syntax for a MIME media type string.
0N/A */
0N/A public INPUT_STREAM (String mimeType) {
0N/A super (mimeType, "java.io.InputStream");
0N/A }
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"text/plain"</CODE>,
0N/A * encoded in the host platform encoding.
0N/A * See {@link DocFlavor#hostEncoding <CODE>hostEncoding</CODE>}
0N/A * Print data representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM TEXT_PLAIN_HOST =
0N/A new INPUT_STREAM ("text/plain; charset="+hostEncoding);
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/plain; charset=utf-8"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM TEXT_PLAIN_UTF_8 =
0N/A new INPUT_STREAM ("text/plain; charset=utf-8");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/plain; charset=utf-16"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM TEXT_PLAIN_UTF_16 =
0N/A new INPUT_STREAM ("text/plain; charset=utf-16");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/plain; charset=utf-16be"</CODE>
0N/A * (big-endian byte ordering),
0N/A * print data representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM TEXT_PLAIN_UTF_16BE =
0N/A new INPUT_STREAM ("text/plain; charset=utf-16be");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/plain; charset=utf-16le"</CODE>
0N/A * (little-endian byte ordering),
0N/A * print data representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM TEXT_PLAIN_UTF_16LE =
0N/A new INPUT_STREAM ("text/plain; charset=utf-16le");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/plain; charset=us-ascii"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM TEXT_PLAIN_US_ASCII =
0N/A new INPUT_STREAM ("text/plain; charset=us-ascii");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"text/html"</CODE>,
0N/A * encoded in the host platform encoding.
0N/A * See {@link DocFlavor#hostEncoding <CODE>hostEncoding</CODE>}
0N/A * Print data representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM TEXT_HTML_HOST =
0N/A new INPUT_STREAM ("text/html; charset="+hostEncoding);
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/html; charset=utf-8"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM TEXT_HTML_UTF_8 =
0N/A new INPUT_STREAM ("text/html; charset=utf-8");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/html; charset=utf-16"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM TEXT_HTML_UTF_16 =
0N/A new INPUT_STREAM ("text/html; charset=utf-16");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/html; charset=utf-16be"</CODE>
0N/A * (big-endian byte ordering),
0N/A * print data representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM TEXT_HTML_UTF_16BE =
0N/A new INPUT_STREAM ("text/html; charset=utf-16be");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/html; charset=utf-16le"</CODE>
0N/A * (little-endian byte ordering),
0N/A * print data representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM TEXT_HTML_UTF_16LE =
0N/A new INPUT_STREAM ("text/html; charset=utf-16le");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/html; charset=us-ascii"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM TEXT_HTML_US_ASCII =
0N/A new INPUT_STREAM ("text/html; charset=us-ascii");
0N/A
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"application/pdf"</CODE>, print
0N/A * data representation class name = <CODE>"java.io.InputStream"</CODE>
0N/A * (byte stream).
0N/A */
0N/A public static final INPUT_STREAM PDF = new INPUT_STREAM ("application/pdf");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"application/postscript"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM POSTSCRIPT =
0N/A new INPUT_STREAM ("application/postscript");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"application/vnd.hp-PCL"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM PCL =
0N/A new INPUT_STREAM ("application/vnd.hp-PCL");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"image/gif"</CODE>, print data
0N/A * representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM GIF = new INPUT_STREAM ("image/gif");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"image/jpeg"</CODE>, print data
0N/A * representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM JPEG = new INPUT_STREAM ("image/jpeg");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"image/png"</CODE>, print data
0N/A * representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A */
0N/A public static final INPUT_STREAM PNG = new INPUT_STREAM ("image/png");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"application/octet-stream"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"java.io.InputStream"</CODE> (byte stream).
0N/A * The client must determine that data described
0N/A * using this DocFlavor is valid for the printer.
0N/A */
0N/A public static final INPUT_STREAM AUTOSENSE =
0N/A new INPUT_STREAM ("application/octet-stream");
0N/A
0N/A }
0N/A
0N/A /**
0N/A * Class DocFlavor.URL provides predefined static constant DocFlavor
0N/A * objects.
0N/A * For example doc flavors using a Uniform Resource Locator ({@link
0N/A * java.net.URL <CODE>java.net.URL</CODE>}) as the print data
0N/A * representation class.
0N/A * <P>
0N/A *
0N/A * @author Alan Kaminsky
0N/A */
0N/A public static class URL extends DocFlavor {
0N/A
0N/A /**
0N/A * Constructs a new doc flavor with the given MIME type and a print
0N/A * data representation class name of <CODE>"java.net.URL"</CODE>.
0N/A *
0N/A * @param mimeType MIME media type string.
0N/A *
0N/A * @exception NullPointerException
0N/A * (unchecked exception) Thrown if <CODE>mimeType</CODE> is null.
0N/A * @exception IllegalArgumentException
0N/A * (unchecked exception) Thrown if <CODE>mimeType</CODE> does not
0N/A * obey the syntax for a MIME media type string.
0N/A */
0N/A public URL (String mimeType) {
0N/A super (mimeType, "java.net.URL");
0N/A }
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"text/plain"</CODE>,
0N/A * encoded in the host platform encoding.
0N/A * See {@link DocFlavor#hostEncoding <CODE>hostEncoding</CODE>}
0N/A * Print data representation class name =
0N/A * <CODE>"java.net.URL"</CODE> (byte stream).
0N/A */
0N/A public static final URL TEXT_PLAIN_HOST =
0N/A new URL ("text/plain; charset="+hostEncoding);
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/plain; charset=utf-8"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"java.net.URL"</CODE> (byte stream).
0N/A */
0N/A public static final URL TEXT_PLAIN_UTF_8 =
0N/A new URL ("text/plain; charset=utf-8");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/plain; charset=utf-16"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>java.net.URL""</CODE> (byte stream).
0N/A */
0N/A public static final URL TEXT_PLAIN_UTF_16 =
0N/A new URL ("text/plain; charset=utf-16");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/plain; charset=utf-16be"</CODE>
0N/A * (big-endian byte ordering),
0N/A * print data representation class name =
0N/A * <CODE>"java.net.URL"</CODE> (byte stream).
0N/A */
0N/A public static final URL TEXT_PLAIN_UTF_16BE =
0N/A new URL ("text/plain; charset=utf-16be");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/plain; charset=utf-16le"</CODE>
0N/A * (little-endian byte ordering),
0N/A * print data representation class name =
0N/A * <CODE>"java.net.URL"</CODE> (byte stream).
0N/A */
0N/A public static final URL TEXT_PLAIN_UTF_16LE =
0N/A new URL ("text/plain; charset=utf-16le");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/plain; charset=us-ascii"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"java.net.URL"</CODE> (byte stream).
0N/A */
0N/A public static final URL TEXT_PLAIN_US_ASCII =
0N/A new URL ("text/plain; charset=us-ascii");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"text/html"</CODE>,
0N/A * encoded in the host platform encoding.
0N/A * See {@link DocFlavor#hostEncoding <CODE>hostEncoding</CODE>}
0N/A * Print data representation class name =
0N/A * <CODE>"java.net.URL"</CODE> (byte stream).
0N/A */
0N/A public static final URL TEXT_HTML_HOST =
0N/A new URL ("text/html; charset="+hostEncoding);
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/html; charset=utf-8"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"java.net.URL"</CODE> (byte stream).
0N/A */
0N/A public static final URL TEXT_HTML_UTF_8 =
0N/A new URL ("text/html; charset=utf-8");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/html; charset=utf-16"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"java.net.URL"</CODE> (byte stream).
0N/A */
0N/A public static final URL TEXT_HTML_UTF_16 =
0N/A new URL ("text/html; charset=utf-16");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/html; charset=utf-16be"</CODE>
0N/A * (big-endian byte ordering),
0N/A * print data representation class name =
0N/A * <CODE>"java.net.URL"</CODE> (byte stream).
0N/A */
0N/A public static final URL TEXT_HTML_UTF_16BE =
0N/A new URL ("text/html; charset=utf-16be");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/html; charset=utf-16le"</CODE>
0N/A * (little-endian byte ordering),
0N/A * print data representation class name =
0N/A * <CODE>"java.net.URL"</CODE> (byte stream).
0N/A */
0N/A public static final URL TEXT_HTML_UTF_16LE =
0N/A new URL ("text/html; charset=utf-16le");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"text/html; charset=us-ascii"</CODE>,
0N/A * print data representation class name =
0N/A * <CODE>"java.net.URL"</CODE> (byte stream).
0N/A */
0N/A public static final URL TEXT_HTML_US_ASCII =
0N/A new URL ("text/html; charset=us-ascii");
0N/A
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"application/pdf"</CODE>, print
0N/A * data representation class name = <CODE>"java.net.URL"</CODE>.
0N/A */
0N/A public static final URL PDF = new URL ("application/pdf");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"application/postscript"</CODE>,
0N/A * print data representation class name = <CODE>"java.net.URL"</CODE>.
0N/A */
0N/A public static final URL POSTSCRIPT = new URL ("application/postscript");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"application/vnd.hp-PCL"</CODE>,
0N/A * print data representation class name = <CODE>"java.net.URL"</CODE>.
0N/A */
0N/A public static final URL PCL = new URL ("application/vnd.hp-PCL");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"image/gif"</CODE>, print data
0N/A * representation class name = <CODE>"java.net.URL"</CODE>.
0N/A */
0N/A public static final URL GIF = new URL ("image/gif");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"image/jpeg"</CODE>, print data
0N/A * representation class name = <CODE>"java.net.URL"</CODE>.
0N/A */
0N/A public static final URL JPEG = new URL ("image/jpeg");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"image/png"</CODE>, print data
0N/A * representation class name = <CODE>"java.net.URL"</CODE>.
0N/A */
0N/A public static final URL PNG = new URL ("image/png");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type =
0N/A * <CODE>"application/octet-stream"</CODE>,
0N/A * print data representation class name = <CODE>"java.net.URL"</CODE>.
0N/A * The client must determine that data described
0N/A * using this DocFlavor is valid for the printer.
0N/A */
0N/A public static final URL AUTOSENSE = new URL ("application/octet-stream");
0N/A
0N/A }
0N/A
0N/A /**
0N/A * Class DocFlavor.CHAR_ARRAY provides predefined static constant
0N/A * DocFlavor objects for example doc flavors using a character array
0N/A * (<CODE>char[]</CODE>) as the print data representation class. As such,
0N/A * the character set is Unicode.
0N/A * <P>
0N/A *
0N/A * @author Alan Kaminsky
0N/A */
0N/A public static class CHAR_ARRAY extends DocFlavor {
0N/A
0N/A private static final long serialVersionUID = -8720590903724405128L;
0N/A
0N/A /**
0N/A * Constructs a new doc flavor with the given MIME type and a print
0N/A * data representation class name of
0N/A * <CODE>"[C"</CODE> (character array).
0N/A *
0N/A * @param mimeType MIME media type string. If it is a text media
0N/A * type, it is assumed to contain a
0N/A * <CODE>"charset=utf-16"</CODE> parameter.
0N/A *
0N/A * @exception NullPointerException
0N/A * (unchecked exception) Thrown if <CODE>mimeType</CODE> is null.
0N/A * @exception IllegalArgumentException
0N/A * (unchecked exception) Thrown if <CODE>mimeType</CODE> does not
0N/A * obey the syntax for a MIME media type string.
0N/A */
0N/A public CHAR_ARRAY (String mimeType) {
0N/A super (mimeType, "[C");
0N/A }
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"text/plain;
0N/A * charset=utf-16"</CODE>, print data representation class name =
0N/A * <CODE>"[C"</CODE> (character array).
0N/A */
0N/A public static final CHAR_ARRAY TEXT_PLAIN =
0N/A new CHAR_ARRAY ("text/plain; charset=utf-16");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"text/html;
0N/A * charset=utf-16"</CODE>, print data representation class name =
0N/A * <CODE>"[C"</CODE> (character array).
0N/A */
0N/A public static final CHAR_ARRAY TEXT_HTML =
0N/A new CHAR_ARRAY ("text/html; charset=utf-16");
0N/A
0N/A }
0N/A
0N/A /**
0N/A * Class DocFlavor.STRING provides predefined static constant DocFlavor
0N/A * objects for example doc flavors using a string ({@link java.lang.String
0N/A * <CODE>java.lang.String</CODE>}) as the print data representation class.
0N/A * As such, the character set is Unicode.
0N/A * <P>
0N/A *
0N/A * @author Alan Kaminsky
0N/A */
0N/A public static class STRING extends DocFlavor {
0N/A
0N/A private static final long serialVersionUID = 4414407504887034035L;
0N/A
0N/A /**
0N/A * Constructs a new doc flavor with the given MIME type and a print
0N/A * data representation class name of <CODE>"java.lang.String"</CODE>.
0N/A *
0N/A * @param mimeType MIME media type string. If it is a text media
0N/A * type, it is assumed to contain a
0N/A * <CODE>"charset=utf-16"</CODE> parameter.
0N/A *
0N/A * @exception NullPointerException
0N/A * (unchecked exception) Thrown if <CODE>mimeType</CODE> is null.
0N/A * @exception IllegalArgumentException
0N/A * (unchecked exception) Thrown if <CODE>mimeType</CODE> does not
0N/A * obey the syntax for a MIME media type string.
0N/A */
0N/A public STRING (String mimeType) {
0N/A super (mimeType, "java.lang.String");
0N/A }
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"text/plain;
0N/A * charset=utf-16"</CODE>, print data representation class name =
0N/A * <CODE>"java.lang.String"</CODE>.
0N/A */
0N/A public static final STRING TEXT_PLAIN =
0N/A new STRING ("text/plain; charset=utf-16");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"text/html;
0N/A * charset=utf-16"</CODE>, print data representation class name =
0N/A * <CODE>"java.lang.String"</CODE>.
0N/A */
0N/A public static final STRING TEXT_HTML =
0N/A new STRING ("text/html; charset=utf-16");
0N/A }
0N/A
0N/A /**
0N/A * Class DocFlavor.READER provides predefined static constant DocFlavor
0N/A * objects for example doc flavors using a character stream ({@link
0N/A * java.io.Reader <CODE>java.io.Reader</CODE>}) as the print data
0N/A * representation class. As such, the character set is Unicode.
0N/A * <P>
0N/A *
0N/A * @author Alan Kaminsky
0N/A */
0N/A public static class READER extends DocFlavor {
0N/A
0N/A private static final long serialVersionUID = 7100295812579351567L;
0N/A
0N/A /**
0N/A * Constructs a new doc flavor with the given MIME type and a print
0N/A * data representation class name of\
0N/A * <CODE>"java.io.Reader"</CODE> (character stream).
0N/A *
0N/A * @param mimeType MIME media type string. If it is a text media
0N/A * type, it is assumed to contain a
0N/A * <CODE>"charset=utf-16"</CODE> parameter.
0N/A *
0N/A * @exception NullPointerException
0N/A * (unchecked exception) Thrown if <CODE>mimeType</CODE> is null.
0N/A * @exception IllegalArgumentException
0N/A * (unchecked exception) Thrown if <CODE>mimeType</CODE> does not
0N/A * obey the syntax for a MIME media type string.
0N/A */
0N/A public READER (String mimeType) {
0N/A super (mimeType, "java.io.Reader");
0N/A }
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"text/plain;
0N/A * charset=utf-16"</CODE>, print data representation class name =
0N/A * <CODE>"java.io.Reader"</CODE> (character stream).
0N/A */
0N/A public static final READER TEXT_PLAIN =
0N/A new READER ("text/plain; charset=utf-16");
0N/A
0N/A /**
0N/A * Doc flavor with MIME type = <CODE>"text/html;
0N/A * charset=utf-16"</CODE>, print data representation class name =
0N/A * <CODE>"java.io.Reader"</CODE> (character stream).
0N/A */
0N/A public static final READER TEXT_HTML =
0N/A new READER ("text/html; charset=utf-16");
0N/A
0N/A }
0N/A
0N/A /**
0N/A * Class DocFlavor.SERVICE_FORMATTED provides predefined static constant
0N/A * DocFlavor objects for example doc flavors for service formatted print
0N/A * data.
0N/A * <P>
0N/A *
0N/A * @author Alan Kaminsky
0N/A */
0N/A public static class SERVICE_FORMATTED extends DocFlavor {
0N/A
0N/A private static final long serialVersionUID = 6181337766266637256L;
0N/A
0N/A /**
0N/A * Constructs a new doc flavor with a MIME type of
0N/A * <CODE>"application/x-java-jvm-local-objectref"</CODE> indicating
0N/A * service formatted print data and the given print data
0N/A * representation class name.
0N/A *
0N/A * @param className Fully-qualified representation class name.
0N/A *
0N/A * @exception NullPointerException
0N/A * (unchecked exception) Thrown if <CODE>className</CODE> is
0N/A * null.
0N/A */
0N/A public SERVICE_FORMATTED (String className) {
0N/A super ("application/x-java-jvm-local-objectref", className);
0N/A }
0N/A
0N/A /**
0N/A * Service formatted print data doc flavor with print data
0N/A * representation class name =
0N/A * <CODE>"java.awt.image.renderable.RenderableImage"</CODE>
0N/A * (renderable image object).
0N/A */
0N/A public static final SERVICE_FORMATTED RENDERABLE_IMAGE =
0N/A new SERVICE_FORMATTED("java.awt.image.renderable.RenderableImage");
0N/A
0N/A /**
0N/A * Service formatted print data doc flavor with print data
0N/A * representation class name = <CODE>"java.awt.print.Printable"</CODE>
0N/A * (printable object).
0N/A */
0N/A public static final SERVICE_FORMATTED PRINTABLE =
0N/A new SERVICE_FORMATTED ("java.awt.print.Printable");
0N/A
0N/A /**
0N/A * Service formatted print data doc flavor with print data
0N/A * representation class name = <CODE>"java.awt.print.Pageable"</CODE>
0N/A * (pageable object).
0N/A */
0N/A public static final SERVICE_FORMATTED PAGEABLE =
0N/A new SERVICE_FORMATTED ("java.awt.print.Pageable");
0N/A
0N/A }
0N/A
0N/A}