com.hp.hpl.jena.util
Class FileUtils

java.lang.Object
  extended bycom.hp.hpl.jena.util.FileUtils

public class FileUtils
extends java.lang.Object


Constructor Summary
FileUtils()
           
 
Method Summary
static java.io.Reader asUTF8(java.io.InputStream in)
           
static java.io.Writer asUTF8(java.io.OutputStream out)
           
static java.io.File getScratchDirectory(java.lang.String prefix)
          Answer a File naming a freshly-created directory in the temporary directory.
static java.lang.String getTempDirectory()
           
static java.io.BufferedReader openResourceFile(java.lang.String filename)
          Open an resource file for reading.
static java.io.InputStream openResourceFileAsStream(java.lang.String filename)
          Open an resource file for reading.
static java.lang.String readWholeFileAsUTF8(java.lang.String filename)
           
static java.io.File tempFileName(java.lang.String prefix, java.lang.String suffix)
          create a temporary file that will be deleted on exit, and do something sensible with any IO exceptions - namely, throw them up wrapped in a JenaException.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils()
Method Detail

readWholeFileAsUTF8

public static java.lang.String readWholeFileAsUTF8(java.lang.String filename)
                                            throws java.io.IOException
Throws:
java.io.IOException

asUTF8

public static java.io.Reader asUTF8(java.io.InputStream in)

asUTF8

public static java.io.Writer asUTF8(java.io.OutputStream out)

tempFileName

public static java.io.File tempFileName(java.lang.String prefix,
                                        java.lang.String suffix)
create a temporary file that will be deleted on exit, and do something sensible with any IO exceptions - namely, throw them up wrapped in a JenaException.

Parameters:
prefix - the prefix for File.createTempFile
suffix - the suffix for File.createTempFile
Returns:
the temporary File

getScratchDirectory

public static java.io.File getScratchDirectory(java.lang.String prefix)
Answer a File naming a freshly-created directory in the temporary directory. This directory should be deleted on exit. TODO handle threading issues, mkdir failure, and better cleanup

Parameters:
prefix - the prefix for the directory name
Returns:
a File naming the new directory

getTempDirectory

public static java.lang.String getTempDirectory()

openResourceFile

public static java.io.BufferedReader openResourceFile(java.lang.String filename)
                                               throws java.io.IOException
Open an resource file for reading.

Throws:
java.io.IOException

openResourceFileAsStream

public static java.io.InputStream openResourceFileAsStream(java.lang.String filename)
                                                    throws java.io.FileNotFoundException
Open an resource file for reading.

Throws:
java.io.FileNotFoundException


Copyright © 2000-2003 Hewlett-Packard. All Rights Reserved.