Package org.cip4.jdflib.util
Class StreamUtil
java.lang.Object
org.cip4.jdflib.util.StreamUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclose(InputStream ios) exception catching null safe closestatic voidclose(OutputStream ios) exception catching null safe closestatic voidcopy(InputStream is, OutputStream os) exception catching null safe copystatic InputStreamreturn a reasonably well performing stream for isstatic OutputStreamreturn a reasonably well performing stream for osstatic VStringgetLines(InputStream in) read and tokenize a stream by cr/lfstatic byte[]getMD5(InputStream is) calculate the md5 hashstatic booleanreplaceBytes(InputStream in, OutputStream out, byte[] srcbytes, byte[] targetbytes, int nReplace) replace all occurences of srcbytes with targetbytesstatic voidreset(InputStream stream) static OutputStreamwrite to a stream
-
Constructor Details
-
StreamUtil
public StreamUtil()
-
-
Method Details
-
getBufferedInputStream
return a reasonably well performing stream for is- Parameters:
is-- Returns:
- the buffered stream
-
write2Stream
write to a stream- Parameters:
file- the file to writew- the writer to write to- Returns:
- the stream that was created, null if snafu
-
getBufferedOutputStream
return a reasonably well performing stream for os- Parameters:
os-- Returns:
- the buffered stream
-
getLines
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(InputStream in, OutputStream out, byte[] srcbytes, byte[] targetbytes, int nReplace) replace all occurences of srcbytes with targetbytes- Parameters:
in-out-srcbytes-targetbytes-n-
-
getMD5
calculate the md5 hash- Parameters:
is-- Returns:
-
close
exception catching null safe close- Parameters:
ios-
-
copy
exception catching null safe copy- Parameters:
ios-
-
reset
- Parameters:
stream-
-
close
exception catching null safe close- Parameters:
ios-
-