Package com.logicaldoc.util.io
Class IOUtil
- java.lang.Object
-
- com.logicaldoc.util.io.IOUtil
-
public class IOUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description IOUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
close(Closeable resource)
Close the given resource.static InputStream
getLimitedStream(InputStream input, long limit)
Creates a new input stream that represents the first part of the original stream.static String
getStringFromInputStream(InputStream is)
static byte[]
printIS(InputStream stream)
static void
write(InputStream input, File output)
static void
write(InputStream input, OutputStream output)
-
-
-
Method Detail
-
close
public static void close(Closeable resource)
Close the given resource.- Parameters:
resource
- The resource to be closed.
-
getLimitedStream
public static InputStream getLimitedStream(InputStream input, long limit)
Creates a new input stream that represents the first part of the original stream.- Parameters:
input
- Original input streamlimit
- Size of the new stream, expressed in bytes- Returns:
- the limited input stream
-
write
public static void write(InputStream input, OutputStream output) throws IOException
- Throws:
IOException
-
write
public static void write(InputStream input, File output) throws IOException
- Throws:
IOException
-
getStringFromInputStream
public static String getStringFromInputStream(InputStream is) throws IOException
- Throws:
IOException
-
printIS
public static byte[] printIS(InputStream stream) throws IOException
- Throws:
IOException
-
-