Partager via


ProtoOutputStream Class

Definition

Class to write to a protobuf stream.

[Android.Runtime.Register("android/util/proto/ProtoOutputStream", ApiSince=30, DoNotGenerateAcw=true)]
public sealed class ProtoOutputStream : Java.Lang.Object
[<Android.Runtime.Register("android/util/proto/ProtoOutputStream", ApiSince=30, DoNotGenerateAcw=true)>]
type ProtoOutputStream = class
    inherit Object
Inheritance
ProtoOutputStream
Attributes

Remarks

Class to write to a protobuf stream.

This API is not as convenient or type safe as the standard protobuf classes. If possible, the best recommended library is to use protobuf lite. However, in environments (such as the Android platform itself), a more memory efficient version is necessary.

Each write method takes an ID code from the protoc generated classes and the value to write. To make a nested object, call #start(long) and then #end(long) when you are done.

The ID codes have type information embedded into them, so if you call the incorrect function you will get an IllegalArgumentException.

To retrieve the encoded protobuf stream, call #getBytes().

stream as the top-level objects are finished.

Java documentation for android.util.proto.ProtoOutputStream.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

ProtoOutputStream()

Construct a ProtoOutputStream with the default chunk size.

ProtoOutputStream(Int32)

Construct a ProtoOutputStream with the given chunk size.

        &lt;p&gt;This is for an in-memory proto. The caller should use {@link #getBytes()</code> for the result.
ProtoOutputStream(Stream)

Construct a ProtoOutputStream that sits on top of an OutputStream.

Fields

FieldCountMask
FieldCountPacked
FieldCountRepeated
FieldCountShift
FieldCountSingle
FieldCountUnknown
FieldIdShift
FieldTypeBool
FieldTypeBytes
FieldTypeDouble
FieldTypeEnum
FieldTypeFixed32
FieldTypeFixed64
FieldTypeFloat
FieldTypeInt32
FieldTypeInt64
FieldTypeMask
FieldTypeMessage
FieldTypeSfixed32
FieldTypeSfixed64
FieldTypeShift
FieldTypeSint32
FieldTypeSint64
FieldTypeString
FieldTypeUint32
FieldTypeUint64
WireTypeEndGroup
WireTypeFixed32
WireTypeFixed64
WireTypeLengthDelimited
WireTypeMask
WireTypeStartGroup
WireTypeVarint

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
RawSize

Returns the total size of the data that has been written, after full protobuf encoding has occurred.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

CheckFieldId(Int64, Int64)

Validates that the fieldId provided is of the type and count from expectedType.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Dump(String)

Dump debugging data about the buffers with the given log tag.

End(Int64)

End the object started by start() that returned token.

Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
Flush()

Write remaining data to the output stream.

GetBytes()

Finish the encoding of the data, and return a byte[] with the protobuf formatted data.

GetFieldCountString(Int64)
GetFieldIdString(Int64)
GetFieldTypeString(Int64)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetWireTypeString(Int32)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
MakeFieldId(Int32, Int64)

Combine a fieldId (the field keys in the proto file) and the field flags.

MakeToken(Int32, Boolean, Int32, Int32, Int32)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
Start(Int64)

Start a sub object.

ToArray<T>() (Inherited from Object)
Token2String(Int64)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Write(Int64, Boolean)

Write a boolean value for the given fieldId.

Write(Int64, Byte[])

Write a byte[] value for the given fieldId.

Write(Int64, Double)

Write a value for the given fieldId.

Write(Int64, Int32)

Write a value for the given fieldId.

Write(Int64, Int64)

Write a value for the given fieldId.

Write(Int64, Single)

Write a value for the given fieldId.

Write(Int64, String)

Write a string value for the given fieldId.

WriteTag(Int32, Int32)

Write an individual field tag by hand.

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to