Package org.camunda.spin.impl.util
Class SpinIoUtil
- java.lang.Object
-
- org.camunda.commons.utils.IoUtil
-
- org.camunda.spin.impl.util.SpinIoUtil
-
public class SpinIoUtil extends org.camunda.commons.utils.IoUtil- Author:
- Daniel Meyer
-
-
Field Summary
Fields Modifier and Type Field Description static java.nio.charset.CharsetENCODING_CHARSET
-
Constructor Summary
Constructors Constructor Description SpinIoUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.io.ReaderclasspathResourceAsReader(java.lang.String fileName)static java.io.InputStreamconvertOutputStreamToInputStream(java.io.OutputStream outputStream)Converts aOutputStreamto anInputStreamby coping the data directly.static java.lang.StringgetStringFromInputStream(java.io.InputStream inputStream)Convert anInputStreamto aStringstatic java.lang.StringgetStringFromInputStream(java.io.InputStream inputStream, boolean trim)Convert anInputStreamto aStringstatic java.lang.StringgetStringFromReader(java.io.Reader reader)Convert anReaderto aStringstatic java.lang.StringgetStringFromReader(java.io.Reader reader, boolean trim)Convert anReaderto aStringstatic java.io.ReaderstringAsReader(java.lang.String string)
-
-
-
Method Detail
-
convertOutputStreamToInputStream
public static java.io.InputStream convertOutputStreamToInputStream(java.io.OutputStream outputStream)
Converts aOutputStreamto anInputStreamby coping the data directly. WARNING: Do not use for large data (>100MB). Only for testing purpose.- Parameters:
outputStream- theOutputStreamto convert- Returns:
- the resulting
InputStream
-
getStringFromInputStream
public static java.lang.String getStringFromInputStream(java.io.InputStream inputStream) throws java.io.IOExceptionConvert anInputStreamto aString- Parameters:
inputStream- theInputStreamto convert- Returns:
- the resulting
String - Throws:
java.io.IOException
-
getStringFromInputStream
public static java.lang.String getStringFromInputStream(java.io.InputStream inputStream, boolean trim) throws java.io.IOExceptionConvert anInputStreamto aString- Parameters:
inputStream- theInputStreamto converttrim- trigger if whitespaces are trimmed in the output- Returns:
- the resulting
String - Throws:
java.io.IOException
-
getStringFromReader
public static java.lang.String getStringFromReader(java.io.Reader reader) throws java.io.IOExceptionConvert anReaderto aString- Parameters:
reader- theReaderto convert- Returns:
- the resulting
String - Throws:
java.io.IOException
-
getStringFromReader
public static java.lang.String getStringFromReader(java.io.Reader reader, boolean trim) throws java.io.IOExceptionConvert anReaderto aString- Parameters:
reader- theReaderto converttrim- trigger if whitespaces are trimmed in the output- Returns:
- the resulting
String - Throws:
java.io.IOException
-
classpathResourceAsReader
public static java.io.Reader classpathResourceAsReader(java.lang.String fileName)
-
stringAsReader
public static java.io.Reader stringAsReader(java.lang.String string)
-
-