it.imolinfo.jbi4corba.utils
Class HelperFileUtil

java.lang.Object
  extended by it.imolinfo.jbi4corba.utils.HelperFileUtil

public class HelperFileUtil
extends Object

Utility Class for File manipulation

Author:
Giancarlo Valeri

Field Summary
static int DISABLE
           
static int ENABLE
           
 
Constructor Summary
HelperFileUtil()
           
 
Method Summary
static void changeIDLIncludeStaus(URL idlUrl, int type)
          Remove same specified include from the Idl File passed as argument Process Idl starting from file URL and comments all #include orb.idl or ir.idl
static void copyFile(File in, File out)
          Copy a file.
static void copyFile(URL in, File out)
          Copy a file from an URL
static String readFileAsString(File f)
          Reads file content as a String.
static String readIdlFromFile(File wsdlFile)
          Reads WSDL file and return IDL as a String.
static void writeToFile(InputStream in, File file)
          Write Inpustream on File
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENABLE

public static final int ENABLE
See Also:
Constant Field Values

DISABLE

public static final int DISABLE
See Also:
Constant Field Values
Constructor Detail

HelperFileUtil

public HelperFileUtil()
Method Detail

readFileAsString

public static String readFileAsString(File f)
                               throws IOException
Reads file content as a String.

Parameters:
f - the file to read. Must be not null.
Returns:
a String representing f content, with lines separated by the system dependent terminator string. The returned String is never null, but it may be empty ("").
Throws:
IOException - if the file does not exist, is a directory rather than a regular file, for some other reason cannot be opened for reading or an I/O error occurs.

readIdlFromFile

public static String readIdlFromFile(File wsdlFile)
                              throws IOException
Reads WSDL file and return IDL as a String.

Parameters:
f - the WSDL file to read. Must be not null.
Returns:
a String representing IDL content. The returned String is never null, but it may be empty ("").
Throws:
IOException - if the file does not exist, is a directory rather than a regular file, for some other reason cannot be opened for reading or an I/O error occurs.

writeToFile

public static void writeToFile(InputStream in,
                               File file)
                        throws FileNotFoundException,
                               IOException
Write Inpustream on File

Parameters:
InputStream - Must be not null.
Throws:
IOException - if the file does not exist, is a directory rather than a regular file, for some other reason cannot be opened for reading or an I/O error occurs.
FileNotFoundException

copyFile

public static void copyFile(File in,
                            File out)
                     throws IOException
Copy a file.

Parameters:
in -
out -
Throws:
Exception
IOException

copyFile

public static void copyFile(URL in,
                            File out)
                     throws IOException
Copy a file from an URL

Parameters:
in -
out -
Throws:
Exception
IOException

changeIDLIncludeStaus

public static void changeIDLIncludeStaus(URL idlUrl,
                                         int type)
                                  throws FileNotFoundException,
                                         URISyntaxException,
                                         IOException
Remove same specified include from the Idl File passed as argument Process Idl starting from file URL and comments all #include orb.idl or ir.idl

Parameters:
idlUrl -
Throws:
FileNotFoundException
URISyntaxException
IOException


Copyright © 2005-2010 Imola Informatica. All Rights Reserved.