DESY ACOP Beans Home

de.desy.acop.video.timageio
Class TImageIO

java.lang.Object
  extended by de.desy.acop.video.timageio.TImageIO

public final class TImageIO
extends java.lang.Object

A class containing static convenience methods for performing simple encoding and decoding of Tine image.

Since:
October 2009
Author:
David Melkumyan, DESY Zeuthen

Method Summary
static TBufferedImage read(java.io.File input)
          Returns a TBufferedImage as the result of decoding a supplied File
with an ImageReader chosen automatically from among those currently registered.
static TBufferedImage read(javax.imageio.stream.ImageInputStream stream)
          Returns a TBufferedImage as the result of decoding a supplied ImageInputStream
with an ImageReader chosen automatically from among those currently registered.
If no registered ImageReader claims to be able to read the stream, null is returned.
static TBufferedImage read(java.io.InputStream input)
          Returns a TBufferedImage as the result of decoding a supplied InputStream
with an ImageReader chosen automatically from among those currently registered.
The InputStream is wrapped in an ImageInputStream.
If no registered ImageReader claims to be able to read the resulting stream, null is returned.
static TBufferedImage read(java.net.URL input)
          Returns a TBufferedImage as the result of decoding a supplied URL
with an ImageReader chosen automatically from among those currently registered.
An InputStream is obtained from the URL, which is wrapped in an ImageInputStream.
If no registered ImageReader claims to be able to read the resulting stream, null is returned.
static boolean write(TBufferedImage tbi, java.io.File output)
           
static boolean write(TBufferedImage tbi, javax.imageio.stream.ImageOutputStream output)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

read

public static TBufferedImage read(java.io.File input)
                           throws java.io.IOException
Returns a TBufferedImage as the result of decoding a supplied File
with an ImageReader chosen automatically from among those currently registered.

Note that there is no read method that takes a filename as a String;
use this method instead after creating a File from the filename.

Parameters:
input - a File to read from.
Returns:
a TBufferedImage containing the decoded contents of the input, or null.
Throws:
java.lang.NullPointerException - if input is null.
java.io.IOException - if an error occurs during reading.

read

public static TBufferedImage read(java.io.InputStream input)
                           throws java.io.IOException
Returns a TBufferedImage as the result of decoding a supplied InputStream
with an ImageReader chosen automatically from among those currently registered.
The InputStream is wrapped in an ImageInputStream.
If no registered ImageReader claims to be able to read the resulting stream, null is returned.

The current cache settings from getUseCacheand getCacheDirectory
will be used to control caching in the ImageInputStream that is created.

This method does not attempt to locate ImageReaders that can read directly from an InputStream;
that may be accomplished using IIORegistry and ImageReaderSpi.

This method does not close the provided InputStream after the read operation has completed;
it is the responsibility of the caller to close the stream, if desired.

Parameters:
input - an InputStream to read from.
Returns:
a TBufferedImage containing the decoded contents of the input, or null.
Throws:
java.lang.NullPointerException - if input is null.
java.io.IOException - if an error occurs during reading.

read

public static TBufferedImage read(java.net.URL input)
                           throws java.io.IOException
Returns a TBufferedImage as the result of decoding a supplied URL
with an ImageReader chosen automatically from among those currently registered.
An InputStream is obtained from the URL, which is wrapped in an ImageInputStream.
If no registered ImageReader claims to be able to read the resulting stream, null is returned.

The current cache settings from getUseCacheand getCacheDirectory
will be used to control caching in the ImageInputStream that is created.

This method does not attempt to locate ImageReaders that can read directly from a URL; that may be accomplished using IIORegistry and ImageReaderSpi.

Parameters:
input - a URL to read from.
Returns:
a TBufferedImage containing the decoded contents of the input, or null.
Throws:
java.lang.NullPointerException - if input is null.
java.io.IOException - if an error occurs during reading.

read

public static TBufferedImage read(javax.imageio.stream.ImageInputStream stream)
                           throws java.io.IOException
Returns a TBufferedImage as the result of decoding a supplied ImageInputStream
with an ImageReader chosen automatically from among those currently registered.
If no registered ImageReader claims to be able to read the stream, null is returned.

Unlike most other methods in this class, this method does close the provided ImageInputStream
after the read operation has completed, unless null is returned,
in which case this method does not close the stream.

Parameters:
stream - an ImageInputStream to read from.
Returns:
a TBufferedImage containing the decoded contents of the input, or null.
Throws:
java.lang.NullPointerException - if stream is null.
java.io.IOException - if an error occurs during reading.

write

public static boolean write(TBufferedImage tbi,
                            java.io.File output)
                     throws java.io.IOException
Throws:
java.io.IOException

write

public static boolean write(TBufferedImage tbi,
                            javax.imageio.stream.ImageOutputStream output)
                     throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2010. All Rights Reserved.