Package com.google.common.io

Examples of com.google.common.io.ByteArrayDataOutput.toByteArray()


        byte[] initialhash = mt.hash(full);

        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        MerkleTree.serializer.serialize(mt, out, MessagingService.current_version);
        byte[] serialized = out.toByteArray();

        ByteArrayDataInput in = ByteStreams.newDataInput(serialized);
        MerkleTree restored = MerkleTree.serializer.deserialize(in, MessagingService.current_version);

        assertHashEquals(initialhash, restored.hash(full));
View Full Code Here


      dataWrite.resetValid(maxColumns);
      for (int column = 0; column < maxColumns; column++) {
        Text sampleText = new Text("ROW-NUM:" + row + ", COLUMN-NUM:" + column);
        ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput();
        sampleText.write(dataOutput);
        dataWrite.set(column, new BytesRefWritable(dataOutput.toByteArray()));
      }
      rcFileWriter.append(dataWrite);
    }
    rcFileWriter.close();
  }
View Full Code Here

      dataWrite.resetValid(maxColumns);
      for (int column = 0; column < maxColumns; column++) {
        Text sampleText = new Text("ROW-NUM:" + row + ", COLUMN-NUM:" + column);
        ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput();
        sampleText.write(dataOutput);
        dataWrite.set(column, new BytesRefWritable(dataOutput.toByteArray()));
      }
      rcFileWriter.append(dataWrite);
    }
    rcFileWriter.close();
  }
View Full Code Here

        byte[] initialhash = mt.hash(full);

        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        MerkleTree.serializer.serialize(mt, out, MessagingService.current_version);
        byte[] serialized = out.toByteArray();

        ByteArrayDataInput in = ByteStreams.newDataInput(serialized);
        MerkleTree restored = MerkleTree.serializer.deserialize(in, MessagingService.current_version);

        assertHashEquals(initialhash, restored.hash(full));
View Full Code Here

  }

  public static String serializeInputSplit(InputSplit split) throws IOException {
    ByteArrayDataOutput byteArrayOutputStream =  ByteStreams.newDataOutput();
    split.write(byteArrayOutputStream);
    String encoded = Base64.encodeBase64String(byteArrayOutputStream.toByteArray());
    logger.debug("Encoded split string for split {} : {}", split, encoded);
    return encoded;
  }

  @Override
View Full Code Here

  }

  public static String serializeInputSplit(InputSplit split) throws IOException {
    ByteArrayDataOutput byteArrayOutputStream =  ByteStreams.newDataOutput();
    split.write(byteArrayOutputStream);
    String encoded = Base64.encodeBase64String(byteArrayOutputStream.toByteArray());
    logger.debug("Encoded split string for split {} : {}", split, encoded);
    return encoded;
  }

  @Override
View Full Code Here

  }

  public static String serializeInputSplit(InputSplit split) throws IOException {
    ByteArrayDataOutput byteArrayOutputStream =  ByteStreams.newDataOutput();
    split.write(byteArrayOutputStream);
    String encoded = Base64.encodeBase64String(byteArrayOutputStream.toByteArray());
    logger.debug("Encoded split string for split {} : {}", split, encoded);
    return encoded;
  }

  @Override
View Full Code Here

  }

  private static byte[] toBytes(ConsumerConfig consumerConfig) throws IOException {
    ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput();
    write(dataOutput, consumerConfig);
    return dataOutput.toByteArray();
  }

  public static void write(DataOutput dataOutput, ConsumerConfig consumerConfig) throws IOException {
    dataOutput.writeLong(consumerConfig.getGroupId());
    dataOutput.writeInt(consumerConfig.getGroupSize());
View Full Code Here

  }

  private static byte[] toBytes(Transaction tx) throws IOException {
    ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput();
    write(dataOutput, tx);
    return dataOutput.toByteArray();
  }

  public static void write(DataOutput dataOutput, Transaction tx) throws IOException {
    dataOutput.writeLong(tx.getReadPointer());
    dataOutput.writeLong(tx.getWritePointer());
View Full Code Here

            // field 4: network byte order IP address, 4 bytes
            sourceOutput.writeInt(address);

            // write all at once to avoid Jetty bug
            // TODO: remove this when fixed in Jetty
            output.write(sourceOutput.toByteArray());
        }

        private void socks5(DataInputStream sourceInput, DataOutputStream sourceOutput)
        {
            // adding socks5 no_auth support would be trivial, but we need a client to test it
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.