ezvcard.util
Class IOUtils

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

public class IOUtils
extends Object

I/O helper classes.

Author:
Michael Angstadt

Constructor Summary
IOUtils()
           
 
Method Summary
static void closeQuietly(Closeable closeable)
          Closes a closeable resource, catching its IOException.
static String getFileExtension(File file)
          Gets the extension off a file's name.
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
 

Constructor Detail

IOUtils

public IOUtils()
Method Detail

getFileExtension

public static String getFileExtension(File file)
Gets the extension off a file's name.

Parameters:
file - the file
Returns:
its extension (e.g. "jpg") or null if it doesn't have one

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 © 2012-2013. All Rights Reserved.