Class StreamUtil

java.lang.Object
org.cip4.jdflib.util.StreamUtil

public class StreamUtil extends Object
  • Constructor Details

    • StreamUtil

      public StreamUtil()
  • Method Details

    • getBufferedInputStream

      public static InputStream getBufferedInputStream(InputStream is)
      return a reasonably well performing stream for is
      Parameters:
      is -
      Returns:
      the buffered stream
    • write2Stream

      public static OutputStream write2Stream(IStreamWriter w, OutputStream os)
      write to a stream
      Parameters:
      file - the file to write
      w - the writer to write to
      Returns:
      the stream that was created, null if snafu
    • getBufferedOutputStream

      public static OutputStream getBufferedOutputStream(OutputStream os)
      return a reasonably well performing stream for os
      Parameters:
      os -
      Returns:
      the buffered stream
    • getLines

      public static VString getLines(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(InputStream in, 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(InputStream is)
      calculate the md5 hash
      Parameters:
      is -
      Returns:
    • close

      public static void close(OutputStream ios)
      exception catching null safe close
      Parameters:
      ios -
    • copy

      public static void copy(InputStream is, OutputStream os)
      exception catching null safe copy
      Parameters:
      ios -
    • reset

      public static void reset(InputStream stream)
      Parameters:
      stream -
    • close

      public static void close(InputStream ios)
      exception catching null safe close
      Parameters:
      ios -