public class IO extends Object
Modifier and Type | Field and Description |
---|---|
static String |
encodingAscii |
static String |
encodingUTF8
Java name for UTF-8 encoding
|
static int |
EOF |
static int |
UNSET |
Constructor and Description |
---|
IO() |
Modifier and Type | Method and Description |
---|---|
static Reader |
asASCII(InputStream in)
Create a unbuffered reader 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 AWriter |
wrap(Writer w)
Wrap in a general writer interface
|
static AWriter |
wrapUTF8(OutputStream out)
Wrap in a general writer interface
|
public static final int EOF
public static final int UNSET
public static final String encodingUTF8
public static final String encodingAscii
public static InputStream openFile(String filename)
public static InputStream openFileEx(String filename) throws IOException
filename
- FileNotFoundException
IOException
public static Reader openFileUTF8(String filename)
public static Reader openFileASCII(String filename)
public static Reader asUTF8(InputStream in)
public static Reader asASCII(InputStream in)
public static BufferedReader asBufferedUTF8(InputStream in)
public static Writer asUTF8(OutputStream out)
public static Writer asBufferedUTF8(OutputStream out)
public static AWriter wrapUTF8(OutputStream out)
public static PrintWriter asPrintWriterUTF8(OutputStream out)
public static void close(Closeable resource)
public static void closeSilent(Closeable resource)
public static void close(Closeable resource)
public static void closeSilent(Closeable resource)
public static void close(AWriter resource)
public static void closeSilent(AWriter resource)
public static void close(IndentedWriter resource)
public static void closeSilent(IndentedWriter resource)
public static void exception(IOException ex)
public static void exception(String msg, IOException ex)
public static void flush(OutputStream out)
public static void flush(Writer out)
public static void flush(AWriter out)
public static byte[] readWholeFile(InputStream in)
public static String readWholeFileAsUTF8(String filename) throws IOException
filename
- IOException
public static String readWholeFileAsUTF8(InputStream in) throws IOException
in
- InputStream to be readIOException
Licenced under the Apache License, Version 2.0