org.openjena.atlas.io
Class IO

java.lang.Object
  extended by org.openjena.atlas.io.IO

public class IO
extends Object


Field Summary
static String encodingAscii
           
static String encodingUTF8
          Java name for UTF-8 encoding
static int EOF
           
static int UNSET
           
 
Constructor Summary
IO()
           
 
Method Summary
static Reader asASCII(InputStream in)
          Create a reader that uses ASCII encoding
static BufferedReader asBufferedUTF8(InputStream in)
          Create an buffered reader that uses UTF-8 encoding
static PrintWriter asPrintWriterUTF8(OutputStream out)
          Create a print writer that uses UTF-8 encoding
static Reader asUTF8(InputStream in)
          Create an unbuffered reader that uses UTF-8 encoding
static Writer asUTF8(OutputStream out)
          Create a writer that uses UTF-8 encoding
static void close(Closeable resource)
           
static void exception(IOException ex)
           
static void exception(String msg, IOException ex)
           
static void flush(OutputStream out)
           
static void flush(Writer out)
           
static InputStream openFile(String filename)
          Open an input stream to a file.
static Reader openFileASCII(String filename)
          Open an ASCII Reader for a file.
static InputStream openFileEx(String filename)
          Open an input stream to a file; do not mask IOExceptions.
static Reader openFileUTF8(String filename)
          Open a UTF8 Reader for a file.
static byte[] readWholeFile(InputStream in)
           
static String readWholeFileAsUTF8(InputStream in)
          Read a whole stream as UTF-8
static String readWholeFileAsUTF8(String filename)
          Read a whole file as UTF-8
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EOF

public static final int EOF
See Also:
Constant Field Values

UNSET

public static final int UNSET
See Also:
Constant Field Values

encodingUTF8

public static final String encodingUTF8
Java name for UTF-8 encoding

See Also:
Constant Field Values

encodingAscii

public static final String encodingAscii
See Also:
Constant Field Values
Constructor Detail

IO

public IO()
Method Detail

openFile

public static InputStream openFile(String filename)
Open an input stream to a file. If the filename is null or "-", return System.in If the filename ends in .gz, wrap in GZIPInputStream


openFileEx

public static InputStream openFileEx(String filename)
                              throws IOException
Open an input stream to a file; do not mask IOExceptions. If the filename is null or "-", return System.in If the filename ends in .gz, wrap in GZIPInputStream

Parameters:
filename -
Throws:
FileNotFoundException
IOException

openFileUTF8

public static Reader openFileUTF8(String filename)
Open a UTF8 Reader for a file. If the filename is null or "-", use System.in If the filename ends in .gz, use GZIPInputStream


openFileASCII

public static Reader openFileASCII(String filename)
Open an ASCII Reader for a file. If the filename is null or "-", use System.in If the filename ends in .gz, use GZIPInputStream


asUTF8

public static Reader asUTF8(InputStream in)
Create an unbuffered reader that uses UTF-8 encoding


asASCII

public static Reader asASCII(InputStream in)
Create a reader that uses ASCII encoding


asBufferedUTF8

public static BufferedReader asBufferedUTF8(InputStream in)
Create an buffered reader that uses UTF-8 encoding


asUTF8

public static Writer asUTF8(OutputStream out)
Create a writer that uses UTF-8 encoding


asPrintWriterUTF8

public static PrintWriter asPrintWriterUTF8(OutputStream out)
Create a print writer that uses UTF-8 encoding


close

public static void close(Closeable resource)

exception

public static void exception(IOException ex)

exception

public static void exception(String msg,
                             IOException ex)

flush

public static void flush(OutputStream out)

flush

public static void flush(Writer out)

readWholeFile

public static byte[] readWholeFile(InputStream in)

readWholeFileAsUTF8

public static String readWholeFileAsUTF8(String filename)
                                  throws IOException
Read a whole file as UTF-8

Parameters:
filename -
Returns:
String
Throws:
IOException

readWholeFileAsUTF8

public static String readWholeFileAsUTF8(InputStream in)
                                  throws IOException
Read a whole stream as UTF-8

Parameters:
in - InputStream to be read
Returns:
String
Throws:
IOException


Licenced under the Apache License, Version 2.0