public final class ProtoUtils extends Object
Modifier and Type | Method and Description |
---|---|
static AccessControlList |
fromProto(Acl.AccessControlList acl) |
static AclAction |
fromProto(Acl.AclAction action) |
static AclActions |
fromProto(Acl.AclActions actions) |
static AclEntry |
fromProto(Acl.AclEntry pEntry) |
static AclEntryType |
fromProto(Acl.AclEntryType pAclEntryType) |
static SetAclAction |
fromProto(File.PSetAclAction pSetAclAction)
Converts proto type to wire type.
|
static io.grpc.Status |
fromProto(Status.PStatus status)
Creates a
Status from a protocol buffer type status. |
static List<Acl.NamedAclActions> |
getNamedGroupsProto(ExtendedACLEntries entries) |
static List<Acl.NamedAclActions> |
getNamedUsersProto(ExtendedACLEntries entries) |
static boolean |
isTruncatedMessageException(IOException e)
Checks whether the exception is an
InvalidProtocolBufferException thrown because of
a truncated message. |
static int |
readRawVarint32(InputStream input)
A wrapper of
CodedInputStream.readRawVarint32(InputStream) . |
static int |
readRawVarint32(int firstByte,
InputStream input)
A wrapper of
CodedInputStream.readRawVarint32(InputStream) . |
static Job.TaskInfo.Builder |
setResult(Job.TaskInfo.Builder builder,
byte[] bytes)
A wrapper of
Job.TaskInfo.Builder.setResult(com.google.protobuf.ByteString) to take byte[] as input. |
static Acl.AccessControlList |
toProto(AccessControlList acl) |
static Acl.AclAction |
toProto(AclAction aclAction) |
static Acl.AclActions |
toProto(AclActions actions) |
static Acl.AclEntry |
toProto(AclEntry aclEntry) |
static Acl.AclEntryType |
toProto(AclEntryType entryType) |
static File.PSetAclAction |
toProto(SetAclAction aclAction)
Converts wire type to proto type.
|
static Status.PStatus |
toProto(io.grpc.Status status)
Converts an internal exception status to a protocol buffer type status.
|
public static int readRawVarint32(int firstByte, InputStream input) throws IOException
CodedInputStream.readRawVarint32(InputStream)
.firstByte
- first byte in the input streaminput
- input streamIOException
public static int readRawVarint32(InputStream input) throws IOException
CodedInputStream.readRawVarint32(InputStream)
.input
- input streamIOException
public static Job.TaskInfo.Builder setResult(Job.TaskInfo.Builder builder, byte[] bytes)
Job.TaskInfo.Builder.setResult(com.google.protobuf.ByteString)
to take byte[] as input.builder
- the builder to updatebytes
- results bytes to setpublic static boolean isTruncatedMessageException(IOException e)
InvalidProtocolBufferException
thrown because of
a truncated message.e
- the exceptionInvalidProtocolBufferException
thrown because of
a truncated message.public static Acl.AccessControlList toProto(AccessControlList acl)
acl
- AccessControlList
public static Acl.AclActions toProto(AclActions actions)
actions
- the AclActions
AclActions
public static Acl.AclAction toProto(AclAction aclAction)
aclAction
- the acl actionpublic static Acl.AclEntry toProto(AclEntry aclEntry)
aclEntry
- the acl entrypublic static File.PSetAclAction toProto(SetAclAction aclAction)
aclAction
- the acl action to convertFile.PSetAclAction
equivalentpublic static Status.PStatus toProto(io.grpc.Status status)
status
- the status to convertpublic static Acl.AclEntryType toProto(AclEntryType entryType)
entryType
- the acl entry typepublic static AccessControlList fromProto(Acl.AccessControlList acl)
acl
- the protobuf representationAccessControlList
public static AclActions fromProto(Acl.AclActions actions)
actions
- the protobuf representation of AclActions
AclActions
decoded from the protobuf representationpublic static AclAction fromProto(Acl.AclAction action)
public static AclEntry fromProto(Acl.AclEntry pEntry)
pEntry
- the proto representationAclEntry
instance created from the proto representationpublic static AclEntryType fromProto(Acl.AclEntryType pAclEntryType)
pAclEntryType
- the proto representationAclEntryType
created from the proto representationpublic static SetAclAction fromProto(File.PSetAclAction pSetAclAction)
pSetAclAction
- File.PSetAclAction
SetAclAction
equivalentpublic static io.grpc.Status fromProto(Status.PStatus status)
Status
from a protocol buffer type status.status
- the protocol buffer type statusStatus
public static List<Acl.NamedAclActions> getNamedUsersProto(ExtendedACLEntries entries)
entries
- the extended acl entriespublic static List<Acl.NamedAclActions> getNamedGroupsProto(ExtendedACLEntries entries)
entries
- the extended acl entriesCopyright © 2023. All Rights Reserved.