List of usage examples for com.google.common.io ByteArrayDataOutput toByteArray
byte[] toByteArray();
From source file:co.cask.tigon.data.transaction.queue.hbase.DequeueScanAttributes.java
private static byte[] toBytes(ConsumerConfig consumerConfig) throws IOException { ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput(); write(dataOutput, consumerConfig);//from w ww . j av a 2s .c o m return dataOutput.toByteArray(); }
From source file:org.apache.drill.exec.store.hive.HiveInputReader.java
public static String serializeInputSplit(InputSplit split) throws IOException { ByteArrayDataOutput byteArrayOutputStream = ByteStreams.newDataOutput(); split.write(byteArrayOutputStream);/* w w w . j a v a 2 s . c o m*/ return Base64.encodeBase64String(byteArrayOutputStream.toByteArray()); }
From source file:org.apache.eagle.storage.hbase.query.coprocessor.ProtoBufConverter.java
public static ByteString writableToByteString(Writable writable) throws IOException { ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput(); ;/*from w ww .ja v a 2s .c om*/ writable.write(dataOutput); return ByteString.copyFrom(dataOutput.toByteArray()); }
From source file:org.opendaylight.controller.cluster.datastore.persisted.CommitTransactionPayload.java
public static CommitTransactionPayload create(final TransactionIdentifier transactionId, final DataTreeCandidate candidate) throws IOException { final ByteArrayDataOutput out = ByteStreams.newDataOutput(); transactionId.writeTo(out);/*from ww w. j a v a2 s . co m*/ DataTreeCandidateInputOutput.writeDataTreeCandidate(out, candidate); return new CommitTransactionPayload(out.toByteArray()); }
From source file:com.yubico.u2f.data.messages.key.CodecTestUtils.java
public static byte[] encodeAuthenticateResponse(RawAuthenticateResponse rawAuthenticateResponse) { ByteArrayDataOutput encoded = ByteStreams.newDataOutput(); encoded.write(rawAuthenticateResponse.getUserPresence()); encoded.writeInt((int) rawAuthenticateResponse.getCounter()); encoded.write(rawAuthenticateResponse.getSignature()); return encoded.toByteArray(); }
From source file:org.apache.eagle.storage.hbase.query.coprocessor.ProtoBufConverter.java
public static AggregateProtos.AggregateResult toPBAggregateResult(AggregateResult result) throws IOException { ByteArrayDataOutput output = ByteStreams.newDataOutput(); result.write(output);//w ww .ja v a 2 s . c om return AggregateProtos.AggregateResult.newBuilder().setByteArray(ByteString.copyFrom(output.toByteArray())) .build(); }
From source file:ubic.gemma.model.analysis.expression.coexpression.IdArray.java
private static byte[] pack(EWAHCompressedBitmap bitmap) { ByteArrayDataOutput os = ByteStreams.newDataOutput(); try {/*from www. ja v a 2 s . c o m*/ bitmap.serialize(os); return os.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); } }
From source file:u2f.data.messages.key.RawAuthenticateResponse.java
public static byte[] packBytesToSign(byte[] appIdHash, byte userPresence, long counter, byte[] challengeHash) { ByteArrayDataOutput encoded = ByteStreams.newDataOutput(); encoded.write(appIdHash);//from ww w. j a v a 2s. c o m encoded.write(userPresence); encoded.writeInt((int) counter); encoded.write(challengeHash); return encoded.toByteArray(); }
From source file:com.netflix.suro.message.MessageSetBuilder.java
/** * Create compressed byte[] from the list of messages. Each message contains * byte[] as its message body, so, this method is simply flattening byte[] * for all messages in the messageList//from w w w . ja v a 2s . c o m * * @param messageList a list of messages for payload * @param compression Compression method to be applied to the payload * @return A byte array that encodes the build payload * @throws IOException */ public static byte[] createPayload(List<Message> messageList, Compression compression) throws IOException { ByteArrayDataOutput out = new ByteArrayDataOutputStream(outputStream.get()); for (Message message : messageList) { message.write(out); } return compression.compress(out.toByteArray()); }
From source file:net.caseif.ttt.util.helper.platform.BungeeHelper.java
private static void sendPluginMessage(String subchannel, String content, Player player) { assert player != null; ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF(subchannel);//from w ww . j a v a2s . com if (content != null) { out.writeUTF(content); } player.sendPluginMessage(TTTCore.getPlugin(), "BungeeCord", out.toByteArray()); }