Package io.grpc.protobuf.lite
Class ProtoInputStream
java.lang.Object
java.io.InputStream
io.grpc.protobuf.lite.ProtoInputStream
- All Implemented Interfaces:
Drainable
,KnownLength
,Closeable
,AutoCloseable
An
InputStream
backed by a protobuf.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate com.google.protobuf.MessageLite
private final com.google.protobuf.Parser
<?> private ByteArrayInputStream
-
Constructor Summary
ConstructorsConstructorDescriptionProtoInputStream
(com.google.protobuf.MessageLite message, com.google.protobuf.Parser<?> parser) -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the total number of bytes that can be read (or skipped over) from this object until all bytes have been read out.int
drainTo
(OutputStream target) Transfers the entire contents of this stream to the specified target.(package private) com.google.protobuf.MessageLite
message()
(package private) com.google.protobuf.Parser
<?> parser()
int
read()
int
read
(byte[] b, int off, int len) Methods inherited from class java.io.InputStream
close, mark, markSupported, read, reset, skip
-
Field Details
-
message
-
parser
private final com.google.protobuf.Parser<?> parser -
partial
-
-
Constructor Details
-
ProtoInputStream
ProtoInputStream(com.google.protobuf.MessageLite message, com.google.protobuf.Parser<?> parser)
-
-
Method Details
-
drainTo
Description copied from interface:Drainable
Transfers the entire contents of this stream to the specified target.- Specified by:
drainTo
in interfaceDrainable
- Parameters:
target
- to write to.- Returns:
- number of bytes written.
- Throws:
IOException
-
read
public int read()- Specified by:
read
in classInputStream
-
read
- Overrides:
read
in classInputStream
- 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 interfaceKnownLength
- Overrides:
available
in classInputStream
-
message
com.google.protobuf.MessageLite message() -
parser
com.google.protobuf.Parser<?> parser()
-