org.sf.jlaunchpad.util
Class FileUtil

java.lang.Object
  extended by org.sf.jlaunchpad.util.FileUtil

public final class FileUtil
extends java.lang.Object

This is the class for holding file utilities.

Version:
1.0 05/14/2004
Author:
Alexander Shvets

Constructor Summary
FileUtil()
           
 
Method Summary
static void copy(java.io.InputStream is, java.io.OutputStream os)
           
static void copyFile(java.io.InputStream in, java.lang.String fileName)
           
static void copyFile(java.lang.String fileName, java.io.OutputStream out)
           
static java.io.File copyToFile(java.io.InputStream is, java.io.File file)
          Copies the stream to the temporary file.
static java.io.File copyToTempFile(java.io.InputStream is, java.lang.String prefix, java.lang.String suffix)
          Copies the stream to the temporary file.
static java.lang.String getExtension(java.io.File file)
          Conveinience method that returns the "dot" extension for the given file.
static java.lang.String getExtension(java.lang.String fileName)
          Conveinience method that returns the "dot" extension for the given file.
static java.io.File getFileFromArchive(java.lang.String jarFileName, java.lang.String location, java.lang.String prefix, java.lang.String suffix)
          Gets the Ant project file located inside jar file.
static java.util.jar.Manifest getManifest(java.util.jar.JarFile jarFile)
          Gets the manifest object from jar file.
static java.util.jar.Manifest getManifest(java.lang.String jarFileName)
          Gets the manifest object from jar file.
static byte[] getStreamAsBytes(java.io.InputStream is)
          Converst input stream into the byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtil

public FileUtil()
Method Detail

copyToFile

public static java.io.File copyToFile(java.io.InputStream is,
                                      java.io.File file)
                               throws java.io.IOException
Copies the stream to the temporary file.

Parameters:
is - the input stream
file - the file
Returns:
the temporary file
Throws:
java.io.IOException - I/O Exception

copyFile

public static void copyFile(java.lang.String fileName,
                            java.io.OutputStream out)
                     throws java.io.IOException
Throws:
java.io.IOException

copyFile

public static void copyFile(java.io.InputStream in,
                            java.lang.String fileName)
                     throws java.io.IOException
Throws:
java.io.IOException

copy

public static void copy(java.io.InputStream is,
                        java.io.OutputStream os)
                 throws java.io.IOException
Throws:
java.io.IOException

copyToTempFile

public static java.io.File copyToTempFile(java.io.InputStream is,
                                          java.lang.String prefix,
                                          java.lang.String suffix)
                                   throws java.io.IOException
Copies the stream to the temporary file.

Parameters:
is - the input stream
prefix - the prefix part of the file name
suffix - the suffix part of the file name
Returns:
the temporary file
Throws:
java.io.IOException - I/O Exception

getManifest

public static java.util.jar.Manifest getManifest(java.lang.String jarFileName)
                                          throws java.io.IOException
Gets the manifest object from jar file.

Parameters:
jarFileName - the jar file name
Returns:
the manifest object
Throws:
java.io.IOException - I/O Exception

getManifest

public static java.util.jar.Manifest getManifest(java.util.jar.JarFile jarFile)
                                          throws java.io.IOException
Gets the manifest object from jar file.

Parameters:
jarFile - the jar file
Returns:
the manifest object
Throws:
java.io.IOException - I/O Exception

getStreamAsBytes

public static byte[] getStreamAsBytes(java.io.InputStream is)
                               throws java.io.IOException
Converst input stream into the byte array.

Parameters:
is - the input stream
Returns:
the byte array
Throws:
java.io.IOException - the I/O exception

getFileFromArchive

public static java.io.File getFileFromArchive(java.lang.String jarFileName,
                                              java.lang.String location,
                                              java.lang.String prefix,
                                              java.lang.String suffix)
                                       throws java.io.IOException
Gets the Ant project file located inside jar file.

Parameters:
jarFileName - the name of jar file
location - the location
prefix - the prefic
suffix - the suffix
Returns:
Ant project file
Throws:
java.io.IOException - I/O Exception

getExtension

public static java.lang.String getExtension(java.io.File file)
Conveinience method that returns the "dot" extension for the given file.

Parameters:
file - the file
Returns:
the extension

getExtension

public static java.lang.String getExtension(java.lang.String fileName)
Conveinience method that returns the "dot" extension for the given file.

Parameters:
fileName - the file name
Returns:
the extension


Copyright © 2007-2008 Dream Programs Inc.. All Rights Reserved.