Class ProtoInputStream

java.lang.Object
java.io.InputStream
io.grpc.protobuf.lite.ProtoInputStream
All Implemented Interfaces:
Drainable, KnownLength, Closeable, AutoCloseable

final class ProtoInputStream extends InputStream implements Drainable, KnownLength
An InputStream backed by a protobuf.
  • Field Details

  • Constructor Details

    • ProtoInputStream

      ProtoInputStream(com.google.protobuf.MessageLite message, com.google.protobuf.Parser<?> parser)
  • Method Details

    • drainTo

      public int drainTo(OutputStream target) throws IOException
      Description copied from interface: Drainable
      Transfers the entire contents of this stream to the specified target.
      Specified by:
      drainTo in interface Drainable
      Parameters:
      target - to write to.
      Returns:
      number of bytes written.
      Throws:
      IOException
    • read

      public int read()
      Specified by:
      read in class InputStream
    • read

      public int read(byte[] b, int off, int len) throws IOException
      Overrides:
      read in class InputStream
      Throws:
      IOException
    • available

      public int available()
      Description copied from interface: KnownLength
      Returns the total number of bytes that can be read (or skipped over) from this object until all bytes have been read out.
      Specified by:
      available in interface KnownLength
      Overrides:
      available in class InputStream
    • message

      com.google.protobuf.MessageLite message()
    • parser

      com.google.protobuf.Parser<?> parser()