org.apache.jena.atlas.io
Class IO

java.lang.Object
  extended by org.apache.jena.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 unbuffered reader that uses ASCII encoding
static Writer asASCII(OutputStream out)
          Create a writer that uses ASCII encoding
static BufferedReader asBufferedUTF8(InputStream in)
          Create an buffered reader that uses UTF-8 encoding
static Writer asBufferedUTF8(OutputStream out)
          Create a writer that uses UTF-8 encoding and is buffered.
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(AWriter resource)
           
static void close(Closeable resource)
           
static void close(Closeable resource)
           
static void close(IndentedWriter resource)
           
static void closeSilent(AWriter resource)
           
static void closeSilent(Closeable resource)
           
static void closeSilent(Closeable resource)
           
static void closeSilent(IndentedWriter resource)
           
static void exception(IOException ex)
           
static void exception(String msg, IOException ex)
           
static void flush(AWriter out)
           
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
static String uniqueFilename(String directory, String base, String ext)
           
static AWriter wrap(Writer w)
          Wrap in a general writer interface
static AWriter wrapASCII(OutputStream out)
          Wrap in a general writer interface
static AWriter wrapUTF8(OutputStream out)
          Wrap in a general writer interface
 
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 unbuffered 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


asASCII

public static Writer asASCII(OutputStream out)
Create a writer that uses ASCII encoding


asBufferedUTF8

public static Writer asBufferedUTF8(OutputStream out)
Create a writer that uses UTF-8 encoding and is buffered.


wrap

public static AWriter wrap(Writer w)
Wrap in a general writer interface


wrapUTF8

public static AWriter wrapUTF8(OutputStream out)
Wrap in a general writer interface


wrapASCII

public static AWriter wrapASCII(OutputStream out)
Wrap in a general writer interface


asPrintWriterUTF8

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


close

public static void close(Closeable resource)

closeSilent

public static void closeSilent(Closeable resource)

close

public static void close(Closeable resource)

closeSilent

public static void closeSilent(Closeable resource)

close

public static void close(AWriter resource)

closeSilent

public static void closeSilent(AWriter resource)

close

public static void close(IndentedWriter resource)

closeSilent

public static void closeSilent(IndentedWriter 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)

flush

public static void flush(AWriter 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

uniqueFilename

public static String uniqueFilename(String directory,
                                    String base,
                                    String ext)


Licenced under the Apache License, Version 2.0