|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.semanticdesktop.aperture.util.IOUtil
public class IOUtil
I/O utility methods for working with Readers, Writers, InputStreams, OutputStreams and URLs.
Constructor Summary | |
---|---|
IOUtil()
|
Method Summary | |
---|---|
static int |
fillByteArray(InputStream in,
byte[] byteArray)
Fills the supplied byte array with bytes read from the specified InputStream. |
static int |
fillCharArray(Reader r,
char[] charArray)
Fills the supplied character array with characters read from the specified Reader. |
static byte[] |
readBytes(InputStream in)
Reads all bytes from the supplied input stream and returns them as a byte array. |
static byte[] |
readBytes(InputStream in,
int maxBytes)
Reads bytes from the supplied input stream up until a maximum number of bytes has been reached and returns them as a byte array. |
static char[] |
readChars(Reader r)
Reads all characters from the supplied reader and returns them as an array |
static String |
readString(File file)
Reads the contents from the given file as a String. |
static String |
readString(InputStream in)
Read the contents of the given stream as a String, using the default Charset. |
static String |
readString(InputStream in,
Charset charset)
Read the contents of the given stream as a String, using the given Charset. |
static String |
readString(Reader r)
Reads all characters from the supplied reader and returns them as a String. |
static String |
readString(Reader r,
int maxChars)
Reads a string of at most length maxChars from the supplied Reader. |
static String |
readString(URL url)
Reads the contents from the given URL as a String. |
static String |
rollingHash(InputStream stream)
|
static Reader |
urlToReader(URL url)
Creates a Reader accessing the contents of the specified URL. |
static void |
writeStream(InputStream in,
File file)
Writes all data that can be read from the supplied InputStream to the specified file. |
static void |
writeStream(InputStream in,
OutputStream out)
Writes all data that can be read from the supplied InputStream to the supplied OutputStream. |
static void |
writeString(String contents,
File file)
Writes the contents of the specified String to the specified File. |
static void |
writeString(String contents,
String filename)
Write the contents of the specified contents String to a file with the specified file name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IOUtil()
Method Detail |
---|
public static char[] readChars(Reader r) throws IOException
IOException
public static String readString(File file) throws IOException
IOException
public static String readString(URL url) throws IOException
IOException
public static String readString(InputStream in) throws IOException
IOException
public static String readString(InputStream in, Charset charset) throws IOException
IOException
public static String readString(Reader r) throws IOException
IOException
public static String readString(Reader r, int maxChars) throws IOException
r
- The Reader to read the string from.maxChars
- The maximum number of characters to read.
IOException
public static int fillCharArray(Reader r, char[] charArray) throws IOException
r
- The Reader to read the characters from.charArray
- The character array to fill with characters.
IOException
public static byte[] readBytes(InputStream in) throws IOException
in
- The InputStream supplying the bytes.
IOException
public static byte[] readBytes(InputStream in, int maxBytes) throws IOException
in
- The InputStream supplying the bytes.maxBytes
- The maximum number of bytes to read from the input stream.
IOException
public static String rollingHash(InputStream stream) throws IOException
IOException
public static int fillByteArray(InputStream in, byte[] byteArray) throws IOException
in
- The InputStream to read the bytes from.byteArray
- The byte array to fill with bytes.
IOException
public static void writeStream(InputStream in, File file) throws IOException
IOException
public static void writeStream(InputStream in, OutputStream out) throws IOException
IOException
public static void writeString(String contents, File file) throws IOException
IOException
public static void writeString(String contents, String filename) throws IOException
IOException
public static Reader urlToReader(URL url) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |