OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [javax/] [imageio/] [spi/] [ImageOutputStreamSpi.java] - Blame information for rev 772

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 772 jeremybenn
/* ImageOutputStreamSpi.java -- Service provider for image output streams.
2
   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
3
 
4
This file is part of GNU Classpath.
5
 
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
9
any later version.
10
 
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; see the file COPYING.  If not, write to the
18
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
02110-1301 USA.
20
 
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library.  Thus, the terms and
23
conditions of the GNU General Public License cover the whole
24
combination.
25
 
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under
30
terms of your choice, provided that you also meet, for each linked
31
independent module, the terms and conditions of the license of that
32
module.  An independent module is a module which is not derived from
33
or based on this library.  If you modify this library, you may extend
34
this exception to your version of the library, but you are not
35
obligated to do so.  If you do not wish to do so, delete this
36
exception statement from your version. */
37
 
38
 
39
package javax.imageio.spi;
40
 
41
import java.io.File;
42
import java.io.IOException;
43
 
44
import javax.imageio.stream.ImageOutputStream;
45
 
46
/**
47
 * An abstract superclass for service providers that create
48
 * {@linkplain javax.imageio.stream.ImageOutputStream image output
49
 * streams} for a file, URL, byte array or any other target.
50
 *
51
 * @since 1.4
52
 *
53
 * @author Sascha Brawer (brawer@dandelis.ch)
54
 */
55
public abstract class ImageOutputStreamSpi
56
  extends IIOServiceProvider
57
{
58
  /**
59
   * Indicates which kind of output is produced by the streams
60
   * created by {@link #createOutputStreamInstance(Object)}.
61
   */
62
  protected Class<?> outputClass;
63
 
64
 
65
  /**
66
   * Constructs a service provider for image output streams, given no
67
   * parameters. It is up to the sub-class to set {@link #vendorName},
68
   * {@link #version} and {@link #outputClass} to non-null values.
69
   */
70
  protected ImageOutputStreamSpi()
71
  {
72
  }
73
 
74
 
75
  /**
76
   * Constructs a service provider for image output streams, given the
77
   * vendor name, a version string and the kind of producable output.
78
   *
79
   * @throws IllegalArgumentException if <code>vendorName</code>
80
   * or <code>version</code> is <code>null</code>.
81
   */
82
  public ImageOutputStreamSpi(String vendorName, String version,
83
                              Class<?> outputClass)
84
  {
85
    super(vendorName, version);
86
    this.outputClass = outputClass;
87
  }
88
 
89
 
90
  /**
91
   * Determines which kind of output is produced by the streams
92
   * created by {@link #createOutputStreamInstance(Object)}.
93
   */
94
  public Class<?> getOutputClass()
95
  {
96
    return outputClass;
97
  }
98
 
99
 
100
  /**
101
   * Determines whether <code>ImageOutputStreams</code> created
102
   * by this service provider benefit from using a cache file.
103
   *
104
   * <p>The default behavior is to return <code>false</code>.
105
   *
106
   * @return <code>true</code> if the created streams are faster or
107
   * need less memory when a cache file is being used;
108
   * <code>false</code> if no positive effect results from the cache
109
   * file.
110
   */
111
  public boolean canUseCacheFile()
112
  {
113
    return false;
114
  }
115
 
116
 
117
  /**
118
   * Determines whether <code>ImageOutputStreams</code> created
119
   * by this service provider require the use of a cache file.
120
   *
121
   * <p>The default behavior is to return <code>false</code>.
122
   *
123
   * @return <code>true</code> if the created streams can only work
124
   * when a cache file is being used; <code>false</code> if no cache
125
   * file is needed.
126
   */
127
  public boolean needsCacheFile()
128
  {
129
    return false;
130
  }
131
 
132
 
133
  public abstract ImageOutputStream createOutputStreamInstance(
134
    Object output, boolean useCache, File cacheDir)
135
    throws IOException;
136
 
137
 
138
  public ImageOutputStream createOutputStreamInstance(Object output)
139
    throws IOException
140
  {
141
    return createOutputStreamInstance(output, canUseCacheFile(), null);
142
  }
143
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.