org.riotfamily.common.io
Class IOUtils

java.lang.Object
  extended by org.riotfamily.common.io.IOUtils

public class IOUtils
extends Object


Field Summary
static int BUFFER_SIZE
           
 
Method Summary
static void clear(File file)
           
static void clearDirectory(File f)
           
static void closeReader(Reader reader)
           
static void closeStream(InputStream in)
           
static void closeStream(OutputStream out)
           
static void closeWriter(Writer writer)
           
static int copy(File file, OutputStream out)
          Copies the content of the given File to an OutputStream.
static int copy(File file, Writer out, String encoding)
          Copies the content of the given File to a Writer.
static int copy(InputStream in, OutputStream out)
          Copies the content of the given InputStream to an OutputStream.
static int copy(InputStream in, Writer out, String encoding)
          Copies the content of the given InputStream to a Writer.
static int copy(Reader in, Writer out)
          Copies the content of the given Reader to a Writer.
static void delete(File file)
           
static void deleteRecursive(File f)
           
static void move(File source, File dest)
           
static int serve(File file, OutputStream out)
          Copies the content of the given File to an OutputStream, swallowing exceptions caused by a ClientAbortException.
static int serve(File file, Writer out, String encoding)
          Copies the content of the given File to a Writer, swallowing exceptions caused by a ClientAbortException.
static int serve(InputStream in, OutputStream out)
          Copies the content of the given InputStream to an OutputStream, swallowing exceptions caused by a ClientAbortException.
static int serve(InputStream in, Writer out, String encoding)
          Copies the content of the given InputStream to a Writer, swallowing exceptions caused by a ClientAbortException.
static int serve(Reader in, Writer out)
          Copies the content of the given Reader to a Writer, swallowing exceptions caused by a ClientAbortException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_SIZE

public static final int BUFFER_SIZE
See Also:
Constant Field Values
Method Detail

copy

public static int copy(InputStream in,
                       OutputStream out)
                throws IOException
Copies the content of the given InputStream to an OutputStream. Unlike FileCopyUtils.copy(InputStream, OutputStream) this method does not close the OutputStream (only the InputStream).

Parameters:
in - the stream to copy from
out - the stream to copy to
Returns:
the number of bytes copied
Throws:
IOException - in case of I/O errors

serve

public static int serve(InputStream in,
                        OutputStream out)
                 throws IOException
Copies the content of the given InputStream to an OutputStream, swallowing exceptions caused by a ClientAbortException.

Throws:
IOException
See Also:
copy(InputStream, OutputStream)

copy

public static int copy(File file,
                       OutputStream out)
                throws IOException
Copies the content of the given File to an OutputStream.

Throws:
IOException
See Also:
copy(InputStream, OutputStream)

serve

public static int serve(File file,
                        OutputStream out)
                 throws IOException
Copies the content of the given File to an OutputStream, swallowing exceptions caused by a ClientAbortException.

Throws:
IOException
See Also:
copy(File, OutputStream)

copy

public static int copy(Reader in,
                       Writer out)
                throws IOException
Copies the content of the given Reader to a Writer. Unlike FileCopyUtils.copy(Reader, Writer) this method does not close the Writer (only the Reader).

Parameters:
in - the Reader to copy from
out - the Writer to copy to
Returns:
the number of characters copied
Throws:
IOException - in case of I/O errors

serve

public static int serve(Reader in,
                        Writer out)
                 throws IOException
Copies the content of the given Reader to a Writer, swallowing exceptions caused by a ClientAbortException.

Throws:
IOException
See Also:
copy(Reader, Writer)

copy

public static int copy(InputStream in,
                       Writer out,
                       String encoding)
                throws IOException
Copies the content of the given InputStream to a Writer.

Throws:
IOException
See Also:
copy(Reader, Writer)

serve

public static int serve(InputStream in,
                        Writer out,
                        String encoding)
                 throws IOException
Copies the content of the given InputStream to a Writer, swallowing exceptions caused by a ClientAbortException.

Throws:
IOException
See Also:
copy(InputStream, Writer, String)

copy

public static int copy(File file,
                       Writer out,
                       String encoding)
                throws IOException
Copies the content of the given File to a Writer.

Throws:
IOException
See Also:
copy(InputStream, Writer, String)

serve

public static int serve(File file,
                        Writer out,
                        String encoding)
                 throws IOException
Copies the content of the given File to a Writer, swallowing exceptions caused by a ClientAbortException.

Throws:
IOException
See Also:
copy(File, Writer, String)

closeStream

public static void closeStream(InputStream in)

closeStream

public static void closeStream(OutputStream out)

closeReader

public static void closeReader(Reader reader)

closeWriter

public static void closeWriter(Writer writer)

move

public static void move(File source,
                        File dest)

clear

public static void clear(File file)
                  throws IOException
Throws:
IOException

delete

public static void delete(File file)

clearDirectory

public static void clearDirectory(File f)

deleteRecursive

public static void deleteRecursive(File f)