Package alluxio.util.proto
Class ProtoUtils
- java.lang.Object
-
- alluxio.util.proto.ProtoUtils
-
public final class ProtoUtils extends java.lang.Object
Protobuf related utils.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static alluxio.grpc.SetAclAction
fromProto(alluxio.proto.journal.File.PSetAclAction pSetAclAction)
Converts proto type to wire type.static AccessControlList
fromProto(alluxio.proto.shared.Acl.AccessControlList acl)
static AclAction
fromProto(alluxio.proto.shared.Acl.AclAction action)
static AclActions
fromProto(alluxio.proto.shared.Acl.AclActions actions)
static AclEntry
fromProto(alluxio.proto.shared.Acl.AclEntry pEntry)
static AclEntryType
fromProto(alluxio.proto.shared.Acl.AclEntryType pAclEntryType)
static io.grpc.Status
fromProto(alluxio.proto.status.Status.PStatus status)
Creates aStatus
from a protocol buffer type status.static java.util.List<alluxio.proto.shared.Acl.NamedAclActions>
getNamedGroupsProto(ExtendedACLEntries entries)
static java.util.List<alluxio.proto.shared.Acl.NamedAclActions>
getNamedUsersProto(ExtendedACLEntries entries)
static boolean
isTruncatedMessageException(java.io.IOException e)
Checks whether the exception is anInvalidProtocolBufferException
thrown because of a truncated message.static int
readRawVarint32(int firstByte, java.io.InputStream input)
A wrapper ofCodedInputStream.readRawVarint32(InputStream)
.static int
readRawVarint32(java.io.InputStream input)
A wrapper ofCodedInputStream.readRawVarint32(InputStream)
.static alluxio.proto.journal.File.PSetAclAction
toProto(alluxio.grpc.SetAclAction aclAction)
Converts wire type to proto type.static alluxio.proto.shared.Acl.AccessControlList
toProto(AccessControlList acl)
static alluxio.proto.shared.Acl.AclAction
toProto(AclAction aclAction)
static alluxio.proto.shared.Acl.AclActions
toProto(AclActions actions)
static alluxio.proto.shared.Acl.AclEntry
toProto(AclEntry aclEntry)
static alluxio.proto.shared.Acl.AclEntryType
toProto(AclEntryType entryType)
static alluxio.proto.status.Status.PStatus
toProto(io.grpc.Status status)
Converts an internal exception status to a protocol buffer type status.
-
-
-
Method Detail
-
readRawVarint32
public static int readRawVarint32(int firstByte, java.io.InputStream input) throws java.io.IOException
A wrapper ofCodedInputStream.readRawVarint32(InputStream)
.- Parameters:
firstByte
- first byte in the input streaminput
- input stream- Returns:
- an int value read from the input stream
- Throws:
java.io.IOException
-
readRawVarint32
public static int readRawVarint32(java.io.InputStream input) throws java.io.IOException
A wrapper ofCodedInputStream.readRawVarint32(InputStream)
.- Parameters:
input
- input stream- Returns:
- an int value read from the input stream
- Throws:
java.io.IOException
-
isTruncatedMessageException
public static boolean isTruncatedMessageException(java.io.IOException e)
Checks whether the exception is anInvalidProtocolBufferException
thrown because of a truncated message.- Parameters:
e
- the exception- Returns:
- whether the exception is an
InvalidProtocolBufferException
thrown because of a truncated message.
-
toProto
public static alluxio.proto.shared.Acl.AccessControlList toProto(AccessControlList acl)
- Parameters:
acl
-AccessControlList
- Returns:
- protobuf representation
-
toProto
public static alluxio.proto.shared.Acl.AclActions toProto(AclActions actions)
- Parameters:
actions
- theAclActions
- Returns:
- the protobuf representation of
AclActions
-
toProto
public static alluxio.proto.shared.Acl.AclAction toProto(AclAction aclAction)
- Parameters:
aclAction
- the acl action- Returns:
- the protobuf representation of action
-
toProto
public static alluxio.proto.shared.Acl.AclEntry toProto(AclEntry aclEntry)
- Parameters:
aclEntry
- the acl entry- Returns:
- the proto representation of instance
-
toProto
public static alluxio.proto.journal.File.PSetAclAction toProto(alluxio.grpc.SetAclAction aclAction)
Converts wire type to proto type.- Parameters:
aclAction
- the acl action to convert- Returns:
File.PSetAclAction
equivalent
-
toProto
public static alluxio.proto.status.Status.PStatus toProto(io.grpc.Status status)
Converts an internal exception status to a protocol buffer type status.- Parameters:
status
- the status to convert- Returns:
- the protocol buffer type status
-
toProto
public static alluxio.proto.shared.Acl.AclEntryType toProto(AclEntryType entryType)
- Parameters:
entryType
- the acl entry type- Returns:
- the proto representation of enum
-
fromProto
public static AccessControlList fromProto(alluxio.proto.shared.Acl.AccessControlList acl)
- Parameters:
acl
- the protobuf representation- Returns:
AccessControlList
-
fromProto
public static AclActions fromProto(alluxio.proto.shared.Acl.AclActions actions)
- Parameters:
actions
- the protobuf representation ofAclActions
- Returns:
- the
AclActions
decoded from the protobuf representation
-
fromProto
public static AclAction fromProto(alluxio.proto.shared.Acl.AclAction action)
-
fromProto
public static AclEntry fromProto(alluxio.proto.shared.Acl.AclEntry pEntry)
- Parameters:
pEntry
- the proto representation- Returns:
- the
AclEntry
instance created from the proto representation
-
fromProto
public static AclEntryType fromProto(alluxio.proto.shared.Acl.AclEntryType pAclEntryType)
- Parameters:
pAclEntryType
- the proto representation- Returns:
- the
AclEntryType
created from the proto representation
-
fromProto
public static alluxio.grpc.SetAclAction fromProto(alluxio.proto.journal.File.PSetAclAction pSetAclAction)
Converts proto type to wire type.- Parameters:
pSetAclAction
-File.PSetAclAction
- Returns:
SetAclAction
equivalent
-
fromProto
public static io.grpc.Status fromProto(alluxio.proto.status.Status.PStatus status)
Creates aStatus
from a protocol buffer type status.- Parameters:
status
- the protocol buffer type status- Returns:
- the corresponding
Status
-
getNamedUsersProto
public static java.util.List<alluxio.proto.shared.Acl.NamedAclActions> getNamedUsersProto(ExtendedACLEntries entries)
- Parameters:
entries
- the extended acl entries- Returns:
- a list of the proto representation of the named users actions
-
getNamedGroupsProto
public static java.util.List<alluxio.proto.shared.Acl.NamedAclActions> getNamedGroupsProto(ExtendedACLEntries entries)
- Parameters:
entries
- the extended acl entries- Returns:
- a list of the proto representation of the named group actions
-
-