|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.avis.util.Streams
public final class Streams
General utilities for messing with I/O streams.
Method Summary | |
---|---|
static BufferedReader |
bufferedReaderFor(Reader reader)
Generate a buffered reader wrapper for a reader, if it is not already one. |
static byte[] |
bytesFrom(InputStream in)
Read all the bytes from a stream and then close it. |
static boolean |
close(Closeable in)
Close an input stream. |
static boolean |
eof(Reader in)
Reader's and InputStream's (almost unbelievably) do not have a way to tell when the stream is at eof without modifying it. |
static InputStream |
fileStream(File file)
Open an input stream on a file. |
static InputStream |
fileStream(String filename)
Open an input stream on a file. |
static Properties |
propertiesFrom(InputStream in)
Load a set of java.util.Properties from an input stream and close it. |
static String |
readLine(Reader in)
Read a line from a Reader. |
static InputStream |
resourceStream(String resource)
Open an input stream on a resource. |
static String |
stringFrom(InputStream stream)
Read the entirety of a UTF-8 encoded input stream into a string. |
static String |
stringFrom(Reader reader)
Read the entirety of stream into a string. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static BufferedReader bufferedReaderFor(Reader reader)
public static byte[] bytesFrom(InputStream in) throws IOException
in
- The input stream to read.
IOException
- if an error occurs reading stream.stringFrom(InputStream)
public static boolean eof(Reader in) throws IOException
IOException
public static InputStream fileStream(File file) throws FileNotFoundException
FileNotFoundException
public static InputStream fileStream(String filename) throws FileNotFoundException
FileNotFoundException
public static Properties propertiesFrom(InputStream in) throws IOException
IOException
public static String readLine(Reader in) throws IOException
in
- The reader.
IOException
- if an error occurs reading data.public static InputStream resourceStream(String resource) throws FileNotFoundException
FileNotFoundException
public static String stringFrom(InputStream stream) throws IOException
IOException
public static String stringFrom(Reader reader) throws IOException
IOException
bytesFrom(InputStream)
public static boolean close(Closeable in)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |