@Override public byte[] uncompress(ByteString data, Enum dictIndex) { return data.toByteArray(); } }
public ByteString toByteString() { // We need this copy to create the ByteString as the byte[] 'buf' is not immutable. We reuse // them. return ByteString.copyFrom(this.buf, 0, this.count); }
/** * <code>required string algorithm = 1;</code> */ public org.apache.hbase.thirdparty.com.google.protobuf.ByteString getAlgorithmBytes() { java.lang.Object ref = algorithm_; if (ref instanceof java.lang.String) { org.apache.hbase.thirdparty.com.google.protobuf.ByteString b = org.apache.hbase.thirdparty.com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); algorithm_ = b; return b; } else { return (org.apache.hbase.thirdparty.com.google.protobuf.ByteString) ref; } }
/** * <code>optional string backup_id = 1;</code> */ public java.lang.String getBackupId() { java.lang.Object ref = backupId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { org.apache.hbase.thirdparty.com.google.protobuf.ByteString bs = (org.apache.hbase.thirdparty.com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { backupId_ = s; } return s; } } /**
private static Key getUnwrapKey(Configuration conf, String subject, EncryptionProtos.WrappedKey wrappedKey, Cipher cipher) throws IOException, KeyException { ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] iv = wrappedKey.hasIv() ? wrappedKey.getIv().toByteArray() : null; Encryption.decryptWithSubjectKey(out, wrappedKey.getData().newInput(), wrappedKey.getLength(), subject, conf, cipher, iv); byte[] keyBytes = out.toByteArray(); if (wrappedKey.hasHash()) { if (!Bytes.equals(wrappedKey.getHash().toByteArray(), Encryption.hash128(keyBytes))) { throw new KeyException("Key was not successfully unwrapped"); } } return new SecretKeySpec(keyBytes, wrappedKey.getAlgorithm()); }
@Override protected void deserializeStateData(ProcedureStateSerializer serializer) throws IOException { BytesValue bytesValue = serializer.deserialize(BytesValue.class); ByteString dataString = bytesValue.getValue(); if (dataString.isEmpty()) { data = null; } else { data = dataString.toByteArray(); } }
/** * Get TableCF in TableCFs, if not exist, return null. * */ public static ReplicationProtos.TableCF getTableCF(ReplicationProtos.TableCF[] tableCFs, String table) { for (int i = 0, n = tableCFs.length; i < n; i++) { ReplicationProtos.TableCF tableCF = tableCFs[i]; if (tableCF.getTableName().getQualifier().toStringUtf8().equals(table)) { return tableCF; } } return null; }
/** * This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding * buffers when working with ByteStrings * @param builder current message builder * @param bs ByteString containing the * @throws IOException */ public static void mergeFrom(Message.Builder builder, ByteString bs) throws IOException { final CodedInputStream codedInput = bs.newCodedInput(); codedInput.setSizeLimit(bs.size()); builder.mergeFrom(codedInput); codedInput.checkLastTagWas(0); }
public static Message getResponse( org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.CoprocessorServiceResponse result, com.google.protobuf.Message responsePrototype) throws IOException { Message response; if (result.getValue().hasValue()) { Message.Builder builder = responsePrototype.newBuilderForType(); builder.mergeFrom(result.getValue().getValue().newInput()); response = builder.build(); } else { response = responsePrototype.getDefaultInstanceForType(); } if (LOG.isTraceEnabled()) { LOG.trace("Master Result is value=" + response); } return response; }
/** * <code>optional string failed_message = 6;</code> */ public java.lang.String getFailedMessage() { java.lang.Object ref = failedMessage_; if (!(ref instanceof java.lang.String)) { org.apache.hbase.thirdparty.com.google.protobuf.ByteString bs = (org.apache.hbase.thirdparty.com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { failedMessage_ = s; } return s; } else { return (java.lang.String) ref; } } /**
private Map<String, List<SnapshotRegionManifest.StoreFile>> getRegionHFileReferences( final SnapshotRegionManifest manifest) { Map<String, List<SnapshotRegionManifest.StoreFile>> familyMap = new HashMap<>(manifest.getFamilyFilesCount()); for (SnapshotRegionManifest.FamilyFiles familyFiles: manifest.getFamilyFilesList()) { familyMap.put(familyFiles.getFamilyName().toStringUtf8(), new ArrayList<>(familyFiles.getStoreFilesList())); } return familyMap; }
public static byte [] toBytes(ByteString bs) { return bs.toByteArray(); }
private ByteString getByteString(byte[] bytes) { // return singleton to reduce object allocation return (bytes.length == 0) ? ByteString.EMPTY : ByteString.copyFrom(bytes); }
/** * <code>required string algorithm = 1;</code> */ public java.lang.String getAlgorithm() { java.lang.Object ref = algorithm_; if (!(ref instanceof java.lang.String)) { org.apache.hbase.thirdparty.com.google.protobuf.ByteString bs = (org.apache.hbase.thirdparty.com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { algorithm_ = s; } return s; } else { return (java.lang.String) ref; } } /**
/** * <code>required string peer_id = 1;</code> */ public org.apache.hbase.thirdparty.com.google.protobuf.ByteString getPeerIdBytes() { java.lang.Object ref = peerId_; if (ref instanceof java.lang.String) { org.apache.hbase.thirdparty.com.google.protobuf.ByteString b = org.apache.hbase.thirdparty.com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); peerId_ = b; return b; } else { return (org.apache.hbase.thirdparty.com.google.protobuf.ByteString) ref; } }
/** * Converts a user permission proto to a client user permission object. * @param proto the protobuf UserPermission * @return the converted UserPermission */ public static UserPermission toUserPermission(AccessControlProtos.UserPermission proto) { return new UserPermission(proto.getUser().toStringUtf8(), toPermission(proto.getPermission())); }
private static String getStringForByteString(ByteString bs) { return Bytes.toStringBinary(bs.toByteArray()); }
@Override public ByteString compress(byte[] data, Enum dictIndex) throws IOException { writeCompressed(data, dictIndex); // We need this copy to create the ByteString as the byte[] 'buf' is not immutable. We reuse // them. ByteString result = ByteString.copyFrom(this.buf, 0, this.count); reset(); // Only resets the count - we reuse the byte array. return result; }
/** * <code>optional string remoteWALDir = 12;</code> */ public java.lang.String getRemoteWALDir() { java.lang.Object ref = remoteWALDir_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { org.apache.hbase.thirdparty.com.google.protobuf.ByteString bs = (org.apache.hbase.thirdparty.com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { remoteWALDir_ = s; } return s; } } /**
/** * <code>required string peer_id = 1;</code> */ public org.apache.hbase.thirdparty.com.google.protobuf.ByteString getPeerIdBytes() { java.lang.Object ref = peerId_; if (ref instanceof java.lang.String) { org.apache.hbase.thirdparty.com.google.protobuf.ByteString b = org.apache.hbase.thirdparty.com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); peerId_ = b; return b; } else { return (org.apache.hbase.thirdparty.com.google.protobuf.ByteString) ref; } }