use of com.google.common.io.ByteArrayDataOutput in project hive by apache.
the class LlapTaskSchedulerService method serializeToken.
private static String serializeToken(Token<JobTokenIdentifier> token) {
byte[] bytes = null;
try {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
token.write(out);
bytes = out.toByteArray();
} catch (IOException e) {
// This shouldn't really happen on a byte array.
throw new RuntimeException(e);
}
return Base64.encodeBase64String(bytes);
}
use of com.google.common.io.ByteArrayDataOutput in project cdap by caskdata.
the class StreamConsumerStateStore method encodeOffsets.
/**
* Encodes list of {@link StreamFileOffset} into bytes.
*/
private byte[] encodeOffsets(Iterable<StreamFileOffset> offsets) throws IOException {
// Assumption: Each offset encoded into ~40 bytes and there are 8 offsets (number of live files)
ByteArrayDataOutput output = ByteStreams.newDataOutput(320);
encodeOffsets(offsets, output);
return output.toByteArray();
}
use of com.google.common.io.ByteArrayDataOutput in project cdap by caskdata.
the class DequeueScanAttributes method toBytes.
private static byte[] toBytes(Transaction tx) throws IOException {
ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput();
write(dataOutput, tx);
return dataOutput.toByteArray();
}
use of com.google.common.io.ByteArrayDataOutput in project cdap by caskdata.
the class DequeueScanAttributes method toBytes.
private static byte[] toBytes(ConsumerConfig consumerConfig) throws IOException {
ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput();
write(dataOutput, consumerConfig);
return dataOutput.toByteArray();
}
use of com.google.common.io.ByteArrayDataOutput in project hbase by apache.
the class Mutation method setClusterIds.
/**
* Marks that the clusters with the given clusterIds have consumed the mutation
* @param clusterIds of the clusters that have consumed the mutation
*/
public Mutation setClusterIds(List<UUID> clusterIds) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeInt(clusterIds.size());
for (UUID clusterId : clusterIds) {
out.writeLong(clusterId.getMostSignificantBits());
out.writeLong(clusterId.getLeastSignificantBits());
}
setAttribute(CONSUMED_CLUSTER_IDS, out.toByteArray());
return this;
}
Aggregations