src/share/classes/javax/print/MultiDoc.java

Print this page


   1 /*
   2  * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  50 
  51  *          while (current != null) {
  52  *              processDoc (current.getDoc());
  53  *              current = current.next();
  54  *          }
  55  *      }
  56  * </PRE>
  57  * <P>
  58  * Of course, interface MultiDoc can be implemented in any way that fulfills
  59  * the contract; it doesn't have to use a linked list in the implementation.
  60  * <P>
  61  * To get all the print data for a multidoc print job, a Print Service
  62  * proxy could use either of two patterns:
  63  * <OL TYPE=1>
  64  * <LI>
  65  * The <B>interleaved</B> pattern: Get the doc from the current multidoc. Get
  66  * the print data representation object from the current doc. Get all the print
  67  * data from the print data representation object. Get the next multidoc from
  68  * the current multidoc, and repeat until there are no more. (The code example
  69  * above uses the interleaved pattern.)
  70  * <P>
  71  * <LI>
  72  * The <B>all-at-once</B> pattern: Get the doc from the current multidoc, and
  73  * save the doc in a list. Get the next multidoc from the current multidoc, and
  74  * repeat until there are no more. Then iterate over the list of saved docs. Get
  75  * the print data representation object from the current doc. Get all the print
  76  * data from the print data representation object. Go to the next doc in the
  77  * list, and repeat until there are no more.
  78  * </OL>
  79  * Now, consider a printing client that is generating print data on the fly and
  80  * does not have the resources to store more than one piece of print data at a
  81  * time. If the print service proxy used the all-at-once pattern to get the
  82  * print data, it would pose a problem for such a client; the client would have
  83  * to keep all the docs' print data around until the print service proxy comes
  84  * back and asks for them, which the client is not able to do. To work with such
  85  * a client, the print service proxy must use the interleaved pattern.
  86  * <P>
  87  * To address this problem, and to simplify the design of clients providing
  88 * multiple docs to a Print Job, every Print Service proxy that supports
  89  * multidoc print jobs is required to access a MultiDoc object using the
  90  * interleaved pattern. That is, given a MultiDoc object, the print service


   1 /*
   2  * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  50 
  51  *          while (current != null) {
  52  *              processDoc (current.getDoc());
  53  *              current = current.next();
  54  *          }
  55  *      }
  56  * </PRE>
  57  * <P>
  58  * Of course, interface MultiDoc can be implemented in any way that fulfills
  59  * the contract; it doesn't have to use a linked list in the implementation.
  60  * <P>
  61  * To get all the print data for a multidoc print job, a Print Service
  62  * proxy could use either of two patterns:
  63  * <OL TYPE=1>
  64  * <LI>
  65  * The <B>interleaved</B> pattern: Get the doc from the current multidoc. Get
  66  * the print data representation object from the current doc. Get all the print
  67  * data from the print data representation object. Get the next multidoc from
  68  * the current multidoc, and repeat until there are no more. (The code example
  69  * above uses the interleaved pattern.)
  70  *
  71  * <LI>
  72  * The <B>all-at-once</B> pattern: Get the doc from the current multidoc, and
  73  * save the doc in a list. Get the next multidoc from the current multidoc, and
  74  * repeat until there are no more. Then iterate over the list of saved docs. Get
  75  * the print data representation object from the current doc. Get all the print
  76  * data from the print data representation object. Go to the next doc in the
  77  * list, and repeat until there are no more.
  78  * </OL>
  79  * Now, consider a printing client that is generating print data on the fly and
  80  * does not have the resources to store more than one piece of print data at a
  81  * time. If the print service proxy used the all-at-once pattern to get the
  82  * print data, it would pose a problem for such a client; the client would have
  83  * to keep all the docs' print data around until the print service proxy comes
  84  * back and asks for them, which the client is not able to do. To work with such
  85  * a client, the print service proxy must use the interleaved pattern.
  86  * <P>
  87  * To address this problem, and to simplify the design of clients providing
  88 * multiple docs to a Print Job, every Print Service proxy that supports
  89  * multidoc print jobs is required to access a MultiDoc object using the
  90  * interleaved pattern. That is, given a MultiDoc object, the print service