Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mortbay.util
Class IO

    java.lang.Object
      org.mortbay.component.AbstractLifeCycle
          org.mortbay.thread.BoundedThreadPool
              org.mortbay.util.IO

All Implemented Interfaces:
  Serializable, LifeCycle, ThreadPool

    public class IO

extends BoundedThreadPool

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

See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class org.mortbay.thread.BoundedThreadPool
`BoundedThreadPool.PoolThread`

Nested classes/interfaces inherited from interface org.mortbay.component.LifeCycle
`LifeCycle.Listener`

Field Summary
`static int` | `bufferSize`
`static String` | `CRLF`
`static byte[]` | `CRLF_BYTES`

Fields inherited from class org.mortbay.component.AbstractLifeCycle
`_listeners`

Constructor Summary
`IO()`

Method Summary
`static void` | `close(InputStream is)` closes an input stream, and logs exceptions
`static void` | `close(OutputStream os)` closes an output stream, and logs exceptions
`static void` | `copy(File from, File to)` Copy files or directories
`static void` | `copy(InputStream in, OutputStream out)` Copy Stream in to Stream out until EOF or exception.
`static void` | `copy(InputStream in, OutputStream out, long byteCount)` Copy Stream in to Stream for byteCount bytes or until EOF or exception.
`static void` | `copy(Reader in, Writer out)` Copy Reader to Writer out until EOF or exception.
`static void` | `copy(Reader in, Writer out, long byteCount)` Copy Reader to Writer for byteCount bytes or until EOF or exception.
`static void` | `copyDir(File from, File to)`
`static void` | `copyFile(File from, File to)`
`static void` | `copyThread(InputStream in, OutputStream out)` Copy Stream in to Stream out until EOF or exception.
`static void` | `copyThread(Reader in, Writer out)` Copy Stream in to Stream out until EOF or exception in own thread
`static boolean` | `delete(File file)` Delete File.
`static InputStream` | `getClosedStream()`
`static OutputStream` | `getNullStream()`
`static Writer` | `getNullWriter()`
`static IO` | `instance()`
`static byte[]` | `readBytes(InputStream in)`
`static String` | `toString(InputStream in)` Read input stream to string.
`static String` | `toString(InputStream in, String encoding)` Read input stream to string.
`static String` | `toString(Reader in)` Read input stream to string.

Methods inherited from class org.mortbay.thread.BoundedThreadPool
`dispatch, doStart, doStop, getIdleThreads, getLowThreads, getMaxIdleTimeMs, getMaxThreads, getMinThreads, getName, getQueueSize, getThreads, getThreadsPriority, isDaemon, isLowOnThreads, join, newThread, setDaemon, setLowThreads, setMaxIdleTimeMs, setMaxThreads, setMinThreads, setName, setThreadsPriority, stopJob`

Methods inherited from class org.mortbay.component.AbstractLifeCycle
`addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### CRLF

    public static final 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

### instance

    public static IO instance()

### copyThread

    public static void copyThread(InputStream in,
                                  OutputStream out)

  Copy Stream in to Stream out until EOF or exception. in own thread

### copy

    public static void copy(InputStream in,
                            OutputStream out)
                     throws IOException

  Copy Stream in to Stream out until EOF or exception.

  Throws:
    `IOException`

### copyThread

    public static void copyThread(Reader in,
                                  Writer out)

  Copy Stream in to Stream out until EOF or exception in own thread

### copy

    public static void copy(Reader in,
                            Writer out)
                     throws IOException

  Copy Reader to Writer out until EOF or exception.

  Throws:
    `IOException`

### 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.

  Throws:
    `IOException`

### 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.

  Throws:
    `IOException`

### copy

    public static void copy(File from,
                            File to)
                     throws IOException

  Copy files or directories

  Parameters:
    `from` -
    `to` -
  Throws:
    `IOException`

### copyDir

    public static void copyDir(File from,
                               File to)
                        throws IOException

  Throws:
    `IOException`

### copyFile

    public static void copyFile(File from,
                                File to)
                         throws IOException

  Throws:
    `IOException`

### toString

    public static String toString(InputStream in)
                           throws IOException

  Read input stream to string.

  Throws:
    `IOException`

### toString

    public static String toString(InputStream in,
                                  String encoding)
                           throws IOException

  Read input stream to string.

  Throws:
    `IOException`

### toString

    public static String toString(Reader in)
                           throws IOException

  Read input stream to string.

  Throws:
    `IOException`

### delete

    public static boolean delete(File file)

  Delete File. This delete will recursively delete directories - BE CAREFULL

  Parameters:
    `file` - The file to be deleted.

### close

    public static void close(InputStream is)

  closes an input stream, and logs exceptions

  Parameters:
    `is` - the input stream to close

### readBytes

    public static byte[] readBytes(InputStream in)
                            throws IOException

  Throws:
    `IOException`

### close

    public static void close(OutputStream os)

  closes an output stream, and logs exceptions

  Parameters:
    `os` - the output stream to close

### getNullStream

    public static OutputStream getNullStream()

  Returns:
    An outputstream to nowhere

### getClosedStream

    public static InputStream getClosedStream()

  Returns:
    An outputstream to nowhere

### getNullWriter

    public static Writer getNullWriter()

  Returns:
    An writer to nowhere

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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