com.vividsolutions.jump.util
Class FileUtil

java.lang.Object
  extended by com.vividsolutions.jump.util.FileUtil

public class FileUtil
extends java.lang.Object

File-related utility functions.


Constructor Summary
FileUtil()
           
 
Method Summary
static java.util.List getContents(java.io.InputStream inputStream)
           
static java.util.List getContents(java.lang.String textFileName)
          Reads a text file.
static void setContents(java.lang.String textFileName, java.util.List lines)
          Saves the List of Strings to a file with the given filename.
static void setContents(java.lang.String textFileName, java.lang.String contents)
          Saves the String to a file with the given filename.
 
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

getContents

public static java.util.List getContents(java.lang.String textFileName)
                                  throws java.io.FileNotFoundException,
                                         java.io.IOException
Reads a text file.

Parameters:
textFileName - the pathname of the file to open
Returns:
the lines of the text file
Throws:
java.io.FileNotFoundException - if the text file is not found
java.io.IOException - if the file is not found or another I/O error occurs

setContents

public static void setContents(java.lang.String textFileName,
                               java.lang.String contents)
                        throws java.io.IOException
Saves the String to a file with the given filename.

Parameters:
textFileName - the pathname of the file to create (or overwrite)
contents - the data to save
Throws:
java.io.IOException - if an I/O error occurs.

getContents

public static java.util.List getContents(java.io.InputStream inputStream)
                                  throws java.io.IOException
Throws:
java.io.IOException

setContents

public static void setContents(java.lang.String textFileName,
                               java.util.List lines)
                        throws java.io.IOException
Saves the List of Strings to a file with the given filename.

Parameters:
textFileName - the pathname of the file to create (or overwrite)
lines - the Strings to save as lines in the file
Throws:
java.io.IOException - if an I/O error occurs.


Copyright © 2013 gvSIG. All Rights Reserved.