Package org.cip4.jdflib.util
Class StreamUtil
- java.lang.Object
-
- org.cip4.jdflib.util.StreamUtil
-
public class StreamUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description StreamUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclose(java.io.InputStream ios)exception catching null safe closestatic voidclose(java.io.OutputStream ios)exception catching null safe closestatic voidcopy(java.io.InputStream is, java.io.OutputStream os)exception catching null safe copystatic java.io.InputStreamgetBufferedInputStream(java.io.InputStream is)return a reasonably well performing stream for isstatic java.io.OutputStreamgetBufferedOutputStream(java.io.OutputStream os)return a reasonably well performing stream for osstatic VStringgetLines(java.io.InputStream in)read and tokenize a stream by cr/lfstatic byte[]getMD5(java.io.InputStream is)calculate the md5 hashstatic booleanreplaceBytes(java.io.InputStream in, java.io.OutputStream out, byte[] srcbytes, byte[] targetbytes, int nReplace)replace all occurences of srcbytes with targetbytesstatic voidreset(java.io.InputStream stream)
-
-
-
Method Detail
-
getBufferedInputStream
public static java.io.InputStream getBufferedInputStream(java.io.InputStream is)
return a reasonably well performing stream for is- Parameters:
is-- Returns:
- the buffered stream
-
getBufferedOutputStream
public static java.io.OutputStream getBufferedOutputStream(java.io.OutputStream os)
return a reasonably well performing stream for os- Parameters:
os-- Returns:
- the buffered stream
-
getLines
public static VString getLines(java.io.InputStream in)
read and tokenize a stream by cr/lf- Parameters:
in- the input stream to read- Returns:
- a vector of strings, one for each line
-
replaceBytes
public static boolean replaceBytes(java.io.InputStream in, java.io.OutputStream out, byte[] srcbytes, byte[] targetbytes, int nReplace)replace all occurences of srcbytes with targetbytes- Parameters:
in-out-srcbytes-targetbytes-n-
-
getMD5
public static byte[] getMD5(java.io.InputStream is)
calculate the md5 hash- Parameters:
is-- Returns:
-
close
public static void close(java.io.OutputStream ios)
exception catching null safe close- Parameters:
ios-
-
copy
public static void copy(java.io.InputStream is, java.io.OutputStream os)exception catching null safe copy- Parameters:
ios-
-
reset
public static void reset(java.io.InputStream stream)
- Parameters:
stream-
-
close
public static void close(java.io.InputStream ios)
exception catching null safe close- Parameters:
ios-
-
-