org.axonframework.common.io
Class IOUtils

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

public final class IOUtils
extends Object

Utility methods for IO operations.

Since:
2.0
Author:
Allard Buijze, Knut-Olav Hoven

Field Summary
static Charset UTF8
          Represents the UTF-8 character set.
 
Method Summary
static void closeIfCloseable(Object closeable)
          Close the given closeable if it implements the Closeable interface.
static void closeQuietly(Closeable closeable)
          Closes any Closable object, while suppressing any IOExceptions it will generate.
static void closeQuietlyIfCloseable(Object closeable)
          Closes any object if that object implements Closeable, while suppressing any IOExceptions it will generate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UTF8

public static final Charset UTF8
Represents the UTF-8 character set.

Method Detail

closeQuietly

public static void closeQuietly(Closeable closeable)
Closes any Closable object, while suppressing any IOExceptions it will generate. The given closeable may be null, in which case nothing happens.

Parameters:
closeable - the object to be closed

closeQuietlyIfCloseable

public static void closeQuietlyIfCloseable(Object closeable)
Closes any object if that object implements Closeable, while suppressing any IOExceptions it will generate. The given closeable may be null, in which case nothing happens.

Parameters:
closeable - the object to be closed

closeIfCloseable

public static void closeIfCloseable(Object closeable)
                             throws IOException
Close the given closeable if it implements the Closeable interface. Otherwise, nothing happens. Unlike closeQuietlyIfCloseable(Object), this method does not suppress any exceptions thrown while attempting to close the resource.

Parameters:
closeable - The object to close
Throws:
IOException - when an error occurs while closing the resource


Copyright © 2010-2016. All Rights Reserved.