gcspy.utils
Class FileUtils

java.lang.Object
  extended by gcspy.utils.FileUtils

public class FileUtils
extends java.lang.Object

Utilities for file manipulation

Author:
Tony Printezis

Constructor Summary
FileUtils()
           
 
Method Summary
static boolean exportToTIFF(java.awt.image.RenderedImage image, java.io.File file, boolean overwrite)
          Export a RenderedImage to a TIFF file
static boolean exportToTIFF(java.awt.image.RenderedImage image, java.lang.String fileName, boolean overwrite)
          Export a RenderedImage to a TIFF file
static boolean fileExists(java.lang.String fileName)
          Does a file exist.
static long fileLength(java.lang.String fileName)
          Return the lenght of a file
static void read(java.io.InputStream in, byte[] array, int offset, int len)
          A read from an input stream into a byte array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils()
Method Detail

fileExists

public static boolean fileExists(java.lang.String fileName)
Does a file exist.

Parameters:
fileName -
Returns:
true if it exists

fileLength

public static long fileLength(java.lang.String fileName)
Return the lenght of a file

Parameters:
fileName - The file's path name
Returns:
Its length

read

public static void read(java.io.InputStream in,
                        byte[] array,
                        int offset,
                        int len)
                 throws java.io.IOException
A read from an input stream into a byte array

Parameters:
in - The input stream
array - The target array
offset - The offset in the file
len - The number of bytes to read
Throws:
java.io.IOException

exportToTIFF

public static boolean exportToTIFF(java.awt.image.RenderedImage image,
                                   java.io.File file,
                                   boolean overwrite)
Export a RenderedImage to a TIFF file

Parameters:
image - The image
file - The file
overwrite - Should the file be overwritten
Returns:
true if the write succeeds

exportToTIFF

public static boolean exportToTIFF(java.awt.image.RenderedImage image,
                                   java.lang.String fileName,
                                   boolean overwrite)
Export a RenderedImage to a TIFF file

Parameters:
image - The image
fileName - The file's pathe name
overwrite - Should the file be overwritten
Returns:
true if the write succeeds