org.eclipse.jetty.util
Class IO

java.lang.Object
  extended by org.eclipse.jetty.util.IO

public class IO
extends java.lang.Object

IO Utilities. Provides stream handling utilities in singleton Threadpool implementation accessed by static members.


Field Summary
static int bufferSize
           
static java.lang.String CRLF
           
static byte[] CRLF_BYTES
           
 
Constructor Summary
IO()
           
 
Method Summary
static void close(java.io.InputStream is)
          closes an input stream, and logs exceptions
static void close(java.io.OutputStream os)
          closes an output stream, and logs exceptions
static void close(java.io.Reader reader)
          closes a reader, and logs exceptions
static void close(java.io.Writer writer)
          closes a writer, and logs exceptions
static void copy(java.io.File from, java.io.File to)
          Copy files or directories
static void copy(java.io.InputStream in, java.io.OutputStream out)
          Copy Stream in to Stream out until EOF or exception.
static void copy(java.io.InputStream in, java.io.OutputStream out, long byteCount)
          Copy Stream in to Stream for byteCount bytes or until EOF or exception.
static void copy(java.io.Reader in, java.io.Writer out)
          Copy Reader to Writer out until EOF or exception.
static void copy(java.io.Reader in, java.io.Writer out, long byteCount)
          Copy Reader to Writer for byteCount bytes or until EOF or exception.
static void copyDir(java.io.File from, java.io.File to)
           
static void copyFile(java.io.File from, java.io.File to)
           
static void copyThread(java.io.InputStream in, java.io.OutputStream out)
          Copy Stream in to Stream out until EOF or exception.
static void copyThread(java.io.Reader in, java.io.Writer out)
          Copy Stream in to Stream out until EOF or exception in own thread
static boolean delete(java.io.File file)
          Delete File.
static java.io.InputStream getClosedStream()
           
static java.io.PrintWriter getNullPrintWriter()
           
static java.io.OutputStream getNullStream()
           
static java.io.Writer getNullWriter()
           
static byte[] readBytes(java.io.InputStream in)
           
static java.lang.String toString(java.io.InputStream in)
          Read input stream to string.
static java.lang.String toString(java.io.InputStream in, java.lang.String encoding)
          Read input stream to string.
static java.lang.String toString(java.io.Reader in)
          Read input stream to string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CRLF

public static final java.lang.String CRLF
See Also:
Constant Field Values

CRLF_BYTES

public static final byte[] CRLF_BYTES

bufferSize

public static int bufferSize
Constructor Detail

IO

public IO()
Method Detail

copyThread

public static void copyThread(java.io.InputStream in,
                              java.io.OutputStream out)
Copy Stream in to Stream out until EOF or exception. in own thread


copy

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

Throws:
java.io.IOException

copyThread

public static void copyThread(java.io.Reader in,
                              java.io.Writer out)
Copy Stream in to Stream out until EOF or exception in own thread


copy

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

Throws:
java.io.IOException

copy

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

Throws:
java.io.IOException

copy

public static void copy(java.io.Reader in,
                        java.io.Writer out,
                        long byteCount)
                 throws java.io.IOException
Copy Reader to Writer for byteCount bytes or until EOF or exception.

Throws:
java.io.IOException

copy

public static void copy(java.io.File from,
                        java.io.File to)
                 throws java.io.IOException
Copy files or directories

Parameters:
from -
to -
Throws:
java.io.IOException

copyDir

public static void copyDir(java.io.File from,
                           java.io.File to)
                    throws java.io.IOException
Throws:
java.io.IOException

copyFile

public static void copyFile(java.io.File from,
                            java.io.File to)
                     throws java.io.IOException
Throws:
java.io.IOException

toString

public static java.lang.String toString(java.io.InputStream in)
                                 throws java.io.IOException
Read input stream to string.

Throws:
java.io.IOException

toString

public static java.lang.String toString(java.io.InputStream in,
                                        java.lang.String encoding)
                                 throws java.io.IOException
Read input stream to string.

Throws:
java.io.IOException

toString

public static java.lang.String toString(java.io.Reader in)
                                 throws java.io.IOException
Read input stream to string.

Throws:
java.io.IOException

delete

public static boolean delete(java.io.File file)
Delete File. This delete will recursively delete directories - BE CAREFULL

Parameters:
file - The file to be deleted.

close

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

Parameters:
is - the input stream to close

close

public static void close(java.io.Reader reader)
closes a reader, and logs exceptions

Parameters:
reader - the reader to close

close

public static void close(java.io.Writer writer)
closes a writer, and logs exceptions

Parameters:
writer - the writer to close

readBytes

public static byte[] readBytes(java.io.InputStream in)
                        throws java.io.IOException
Throws:
java.io.IOException

close

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

Parameters:
os - the output stream to close

getNullStream

public static java.io.OutputStream getNullStream()
Returns:
An outputstream to nowhere

getClosedStream

public static java.io.InputStream getClosedStream()
Returns:
An outputstream to nowhere

getNullWriter

public static java.io.Writer getNullWriter()
Returns:
An writer to nowhere

getNullPrintWriter

public static java.io.PrintWriter getNullPrintWriter()
Returns:
An writer to nowhere


Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.