Class InputStreamTool

java.lang.Object
io.datarouter.bytes.InputStreamTool

public class InputStreamTool extends Object
  • Constructor Details

    • InputStreamTool

      public InputStreamTool()
  • Method Details

    • close

      public static void close(InputStream inputStream)
    • count

      public static long count(InputStream inputStream, int bufferSize)
    • countByte

      public static long countByte(InputStream inputStream, int bufferSize, byte matchByte)
    • readRequiredByte

      public static byte readRequiredByte(InputStream inputStream)
      Read 1 byte, throwing if it wasn't found.
    • readUntilLength

      public static int readUntilLength(InputStream inputStream, byte[] buffer, int offset, int length)
      Keeps reading from the InputStream until length bytes are found, or we're out of data. Can be used on InputStreams that return data incrementally but you prefer to block until length bytes are found.
    • readNBytes

      public static byte[] readNBytes(InputStream inputStream, int len)
    • scanChunks

      public static io.datarouter.scanner.Scanner<byte[]> scanChunks(InputStream inputStream, int chunkSize)
    • toArray

      public static byte[] toArray(InputStream inputStream)
    • transferTo

      public static long transferTo(InputStream inputStream, OutputStream outputStream)