IO Utilities.
Provides stream handling utilities in
singleton Threadpool implementation accessed by static members.
close
public static void close(InputStream is)
closes an input stream, and logs exceptions
is
- the input stream to close
close
public static void close(OutputStream os)
closes an output stream, and logs exceptions
os
- the output stream to close
copy
public static void copy(InputStream in,
OutputStream out)
throws IOException
Copy Stream in to Stream out until EOF or exception.
copy
public static void copy(InputStream in,
OutputStream out,
long byteCount)
throws IOException
Copy Stream in to Stream for byteCount bytes or until EOF or exception.
copy
public static void copy(Reader in,
Writer out)
throws IOException
Copy Reader to Writer out until EOF or exception.
copy
public static void copy(Reader in,
Writer out,
long byteCount)
throws IOException
Copy Reader to Writer for byteCount bytes or until EOF or exception.
copyThread
public static void copyThread(InputStream in,
OutputStream out)
Copy Stream in to Stream out until EOF or exception.
in own thread
copyThread
public static void copyThread(Reader in,
Writer out)
Copy Stream in to Stream out until EOF or exception
in own thread
delete
public static boolean delete(File file)
Delete File.
This delete will recursively delete directories - BE CAREFULL
file
- The file to be deleted.
getNullStream
public static OutputStream getNullStream()
- An outputstream to nowhere
getNullWriter
public static Writer getNullWriter()
handle
public void handle(Object o)
Run copy for copyThread()
- handle in interface ThreadPool
instance
public static IO instance()
toString
public static String toString(InputStream in)
throws IOException
Read input stream to string.