org.mortbay.util

Class IO

public class IO extends ThreadPool

IO Utilities. Provides stream handling utilities in singleton Threadpool implementation accessed by static members.
Field Summary
static intbufferSize
static StringCRLF
static byte[]CRLF_BYTES
Method Summary
static voidclose(InputStream is)
closes an input stream, and logs exceptions
static voidclose(OutputStream os)
closes an output stream, and logs exceptions
static voidcopy(InputStream in, OutputStream out)
Copy Stream in to Stream out until EOF or exception.
static voidcopy(Reader in, Writer out)
Copy Reader to Writer out until EOF or exception.
static voidcopy(InputStream in, OutputStream out, long byteCount)
Copy Stream in to Stream for byteCount bytes or until EOF or exception.
static voidcopy(Reader in, Writer out, long byteCount)
Copy Reader to Writer for byteCount bytes or until EOF or exception.
static voidcopyThread(InputStream in, OutputStream out)
Copy Stream in to Stream out until EOF or exception. in own thread
static voidcopyThread(Reader in, Writer out)
Copy Stream in to Stream out until EOF or exception in own thread
static booleandelete(File file)
Delete File.
static OutputStreamgetNullStream()
static WritergetNullWriter()
voidhandle(Object o)
Run copy for copyThread()
static IOinstance()
static StringtoString(InputStream in)
Read input stream to string.

Field Detail

bufferSize

public static int bufferSize

CRLF

public static final String CRLF

CRLF_BYTES

public static final byte[] CRLF_BYTES

Method Detail

close

public static void close(InputStream is)
closes an input stream, and logs exceptions

Parameters: is the input stream to close

close

public static void close(OutputStream os)
closes an output stream, and logs exceptions

Parameters: os the output stream to close

copy

public static void copy(InputStream in, OutputStream out)
Copy Stream in to Stream out until EOF or exception.

copy

public static void copy(Reader in, Writer out)
Copy Reader to Writer out until EOF or exception.

Returns: TODO

copy

public static void copy(InputStream in, OutputStream out, long byteCount)
Copy Stream in to Stream for byteCount bytes or until EOF or exception.

Returns: Copied bytes count or -1 if no bytes were read *and* EOF was reached

copy

public static void copy(Reader in, Writer out, long byteCount)
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

Parameters: file The file to be deleted.

getNullStream

public static OutputStream getNullStream()

Returns: An outputstream to nowhere

getNullWriter

public static Writer getNullWriter()

Returns: An writer to nowhere

handle

public void handle(Object o)
Run copy for copyThread()

instance

public static IO instance()

toString

public static String toString(InputStream in)
Read input stream to string.
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.