biweekly.util
Class IOUtils

java.lang.Object
  extended by biweekly.util.IOUtils

public class IOUtils
extends Object

I/O helper classes.

Author:
Michael Angstadt

Method Summary
static void closeQuietly(Closeable closeable)
          Closes a closeable resource, catching its IOException.
static byte[] toByteArray(InputStream in)
          Reads all the bytes from an input stream.
static byte[] toByteArray(InputStream in, boolean close)
          Reads all the bytes from an input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toByteArray

public static byte[] toByteArray(InputStream in)
                          throws IOException
Reads all the bytes from an input stream.

Parameters:
in - the input stream
Returns:
the bytes
Throws:
IOException - if there's a problem reading from the input stream

toByteArray

public static byte[] toByteArray(InputStream in,
                                 boolean close)
                          throws IOException
Reads all the bytes from an input stream.

Parameters:
in - the input stream
close - true to close the input stream when done, false not to
Returns:
the bytes
Throws:
IOException - if there's a problem reading from the input stream

closeQuietly

public static void closeQuietly(Closeable closeable)
Closes a closeable resource, catching its IOException.

Parameters:
closeable - the resource to close (can be null)


Copyright © 2013 Michael Angstadt. All Rights Reserved.