Package org.avaje.freemarker.util
Class IOUtil
- java.lang.Object
-
- org.avaje.freemarker.util.IOUtil
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidpump(InputStream in, OutputStream out)Reads data from the specified input stream and copies it to the specified output stream, until the input stream is at EOF.static byte[]read(InputStream in)Reads the entire contents of the specified input stream and returns them as a byte array.static Stringread(Reader reader)static StringreadAscii(InputStream in)Reads the entire contents of the specified input stream and returns them as an ASCII string.static StringreadEncoded(InputStream in, String encoding)Reads the entire contents of the specified input stream and returns them as a string using the encoding supplied.static StringreadUtf8(InputStream in)Reads the entire contents of the specified input stream and returns them as UTF-8 string.static StringreadUTF8(InputStream in)
-
-
-
Method Detail
-
read
public static byte[] read(InputStream in) throws IOException
Reads the entire contents of the specified input stream and returns them as a byte array.- Throws:
IOException
-
readAscii
public static String readAscii(InputStream in) throws IOException
Reads the entire contents of the specified input stream and returns them as an ASCII string.- Throws:
IOException
-
readUTF8
public static String readUTF8(InputStream in) throws IOException
- Throws:
IOException
-
readUtf8
public static String readUtf8(InputStream in) throws IOException
Reads the entire contents of the specified input stream and returns them as UTF-8 string.- Throws:
IOException
-
readEncoded
public static String readEncoded(InputStream in, String encoding) throws IOException
Reads the entire contents of the specified input stream and returns them as a string using the encoding supplied.- Throws:
IOException
-
read
public static String read(Reader reader) throws IOException
- Throws:
IOException
-
pump
public static void pump(InputStream in, OutputStream out) throws IOException
Reads data from the specified input stream and copies it to the specified output stream, until the input stream is at EOF. Both streams are then closed.- Throws:
IOException- if the input or output stream isnull
-
-