org.camunda.bpm.cycle.util
Class IoUtil

java.lang.Object
  extended by org.camunda.bpm.cycle.util.IoUtil

public class IoUtil
extends Object

Author:
Tom Baeyens, Frederik Heremans, Joram Barrez, nico.rehwaldt

Field Summary
static boolean DEBUG
          Controls if intermediate results are written to files.
static String DEBUG_DIR
          Directory, into which intermediate results are written.
 
Constructor Summary
IoUtil()
           
 
Method Summary
static void closeSilently(InputStream... streams)
           
static void closeSilently(InputStream inputStream)
          Closes the given stream.
static void closeSilently(OutputStream... streams)
           
static void closeSilently(OutputStream outputStream)
          Closes the given stream.
static int copyBytes(InputStream in, OutputStream out)
           
static File getFile(String filePath)
           
static InputStream readFileAsInputStream(String absoluteClassPath)
           
static String readFileAsString(String filePath)
           
static byte[] readInputStream(InputStream inputStream, String inputStreamName)
           
static InputStream toInputStream(String result, String encoding)
          Returns an input stream serving the given argument
static String toString(InputStream input)
           
static String toString(InputStream input, String encoding)
           
static void writeStringToFile(String content, String filePath)
           
static void writeStringToFileIfDebug(String content, String filename, String suffix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG
Controls if intermediate results are written to files.


DEBUG_DIR

public static String DEBUG_DIR
Directory, into which intermediate results are written.

Constructor Detail

IoUtil

public IoUtil()
Method Detail

readInputStream

public static byte[] readInputStream(InputStream inputStream,
                                     String inputStreamName)

readFileAsString

public static String readFileAsString(String filePath)

readFileAsInputStream

public static InputStream readFileAsInputStream(String absoluteClassPath)

getFile

public static File getFile(String filePath)

writeStringToFile

public static void writeStringToFile(String content,
                                     String filePath)

writeStringToFileIfDebug

public static void writeStringToFileIfDebug(String content,
                                            String filename,
                                            String suffix)

closeSilently

public static void closeSilently(InputStream inputStream)
Closes the given stream. The same as calling InputStream.close(), but errors while closing are silently ignored.


closeSilently

public static void closeSilently(InputStream... streams)

closeSilently

public static void closeSilently(OutputStream outputStream)
Closes the given stream. The same as calling OutputStream.close(), but errors while closing are silently ignored.


closeSilently

public static void closeSilently(OutputStream... streams)

copyBytes

public static int copyBytes(InputStream in,
                            OutputStream out)
                     throws IOException
Throws:
IOException

toString

public static String toString(InputStream input)
                       throws IOException
Throws:
IOException

toString

public static String toString(InputStream input,
                              String encoding)
                       throws IOException
Throws:
IOException

toInputStream

public static InputStream toInputStream(String result,
                                        String encoding)
Returns an input stream serving the given argument

Parameters:
result -
encoding -
Returns:


Copyright © 2014 camunda services GmbH. All rights reserved.