01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: /**
18: * @author Igor A. Pyankov
19: * @version $Revision: 1.2 $
20: */package org.apache.harmony.x.print;
21:
22: import java.io.OutputStream;
23:
24: import javax.print.DocFlavor;
25: import javax.print.StreamPrintService;
26: import javax.print.StreamPrintServiceFactory;
27:
28: /*
29: * PSStreamPrintServiceFactory
30: */
31: public class PSStreamPrintServiceFactory extends
32: StreamPrintServiceFactory {
33:
34: private static final String mimeType = "application/postscript";
35: private static final DocFlavor supportedDocFlavors[] = {
36: DocFlavor.SERVICE_FORMATTED.PRINTABLE,
37: DocFlavor.SERVICE_FORMATTED.PAGEABLE,
38: DocFlavor.BYTE_ARRAY.GIF, DocFlavor.INPUT_STREAM.GIF,
39: DocFlavor.URL.GIF, DocFlavor.BYTE_ARRAY.JPEG,
40: DocFlavor.INPUT_STREAM.JPEG, DocFlavor.URL.JPEG,
41: DocFlavor.BYTE_ARRAY.PNG, DocFlavor.INPUT_STREAM.PNG,
42: DocFlavor.URL.PNG };
43:
44: public String getOutputFormat() {
45: return mimeType;
46: }
47:
48: public DocFlavor[] getSupportedDocFlavors() {
49: DocFlavor copy_supportedDocFlavors[] = new DocFlavor[supportedDocFlavors.length];
50: for (int i = 0; i < supportedDocFlavors.length; i++) {
51: copy_supportedDocFlavors[i] = supportedDocFlavors[i];
52: }
53: return copy_supportedDocFlavors;
54: }
55:
56: public StreamPrintService getPrintService(OutputStream outputstream) {
57: return new All2PSStreamPrintService(outputstream, this);
58: }
59: }
|