Package org.togglz.core.util
Class IOUtils
- java.lang.Object
-
- org.togglz.core.util.IOUtils
-
public class IOUtils extends Object
Provides utility methods for working with I/O streams. Based on com.google.common.io.* from com.google.guava:17.0- Author:
- Chris Nokleberg, Colin Decker, Bin Zhu
-
-
Constructor Summary
Constructors Constructor Description IOUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
close(InputStream s)
static long
copy(InputStream from, OutputStream to)
Copies all bytes from the input stream to the output stream.static long
copy(Readable from, Appendable to)
Copies all characters between theReadable
andAppendable
objects.static String
toString(Readable r)
-
-
-
Method Detail
-
close
public static void close(InputStream s)
-
copy
public static long copy(InputStream from, OutputStream to) throws IOException
Copies all bytes from the input stream to the output stream. Does not close or flush either stream.- Parameters:
from
- the input stream to read fromto
- the output stream to write to- Returns:
- the number of bytes copied
- Throws:
IOException
- if an I/O error occurs
-
toString
public static String toString(Readable r) throws IOException
- Parameters:
r
- the object to read from- Returns:
- a string containing all the characters
- Throws:
IOException
- if an I/O error occurs
-
copy
public static long copy(Readable from, Appendable to) throws IOException
Copies all characters between theReadable
andAppendable
objects. Does not close or flush either object.- Parameters:
from
- the object to read fromto
- the object to write to- Returns:
- the number of characters copied
- Throws:
IOException
- if an I/O error occurs
-
-