Class 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 a Status 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 an InvalidProtocolBufferException thrown because of a truncated message.
      static int readRawVarint32​(int firstByte, java.io.InputStream input)
      A wrapper of CodedInputStream.readRawVarint32(InputStream).
      static int readRawVarint32​(java.io.InputStream input)
      A wrapper of CodedInputStream.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • readRawVarint32

        public static int readRawVarint32​(int firstByte,
                                          java.io.InputStream input)
                                   throws java.io.IOException
        A wrapper of CodedInputStream.readRawVarint32(InputStream).
        Parameters:
        firstByte - first byte in the input stream
        input - 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 of CodedInputStream.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 an InvalidProtocolBufferException 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 - the AclActions
        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 of AclActions
        Returns:
        the AclActions decoded from the protobuf representation
      • fromProto

        public static AclAction fromProto​(alluxio.proto.shared.Acl.AclAction action)
        Parameters:
        action - the protobuf representation of AclAction
        Returns:
        the AclAction decoded from the protobuf representation
      • 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 a Status 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