Java 8 DataOutput - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 DataOutput class.

This code example shows how to use the following methods:writeBoolean
    blacklistReport = Text.readString(in);
  } 
 
  @Override 
  public void write(DataOutput out) throws IOException {
    Text.writeString(out, name);
    out.writeBoolean(isBlacklisted);
    Text.writeString(out, reasonForBlacklist);
    Text.writeString(out, blacklistReport);
  } 
 
} 
8
CodeRank
This code example shows how to use the following methods:writeBoolean
  /** 
   * GenericCounter ::= keyName isDistinctDisplayName [displayName] value 
   */ 
  @Override 
  public synchronized void write(DataOutput out) throws IOException {
    Text.writeString(out, name);
    boolean distinctDisplayName = ! name.equals(displayName);
    out.writeBoolean(distinctDisplayName);
    if (distinctDisplayName) {
      Text.writeString(out, displayName);
    } 
    WritableUtils.writeVLong(out, value);
  } 
 
  @Override 
  public synchronized String getName() {
    return name;
  } 
 
  @Override 
8
CodeRank
This code example shows how to use the following methods:writeBoolean
  } 
  public boolean shouldDie() { 
    return shouldDie;
  } 
  public void write(DataOutput out) throws IOException {
    out.writeBoolean(shouldDie);
    if (t != null) {
      out.writeBoolean(true);
      out.writeBoolean(t.isMapTask());
      t.write(out);
    } else { 
      out.writeBoolean(false);
    } 
  } 
  public void readFields(DataInput in) throws IOException {
    shouldDie = in.readBoolean();
    boolean taskComing = in.readBoolean();
    if (taskComing) {
      boolean isMap = in.readBoolean();
      if (isMap) {
8
CodeRank
This code example shows how to use the following methods:write
 
  /** 
   */ 
  @Override 
  public void write(DataOutput out) throws IOException {
    WritableUtils.writeVInt(out, keyId);
    WritableUtils.writeVLong(out, expiryDate);
    if (keyBytes == null) {
      WritableUtils.writeVInt(out, -1);
    } else { 
      WritableUtils.writeVInt(out, keyBytes.length);
      out.write(keyBytes);
    } 
  } 
 
  /** 
   */ 
  @Override 
  public void readFields(DataInput in) throws IOException {
    keyId = WritableUtils.readVInt(in);
8
CodeRank
This code example shows how to use the following methods:writeInt, writeLong, writeUTF
   
  @Override 
  public void write(DataOutput out) throws IOException {
    LOG.debug("Writing NMTokenIdentifier to RPC layer: " + this);
    ApplicationId applicationId = appAttemptId.getApplicationId();
    out.writeLong(applicationId.getClusterTimestamp());
    out.writeInt(applicationId.getId());
    out.writeInt(appAttemptId.getAttemptId());
    out.writeUTF(this.nodeId.toString());
    out.writeUTF(this.appSubmitter);
    out.writeInt(this.keyId);
  } 
 
  @Override 
  public void readFields(DataInput in) throws IOException {
    appAttemptId =
        ApplicationAttemptId.newInstance( 
            ApplicationId.newInstance(in.readLong(), in.readInt()),
            in.readInt());
    String[] hostAddr = in.readUTF().split(":");
8
CodeRank
This code example shows how to use the following methods:write, writeDouble, writeInt
 
  // Writable 
 
  @Override 
  public void write(DataOutput out) throws IOException {
    out.writeInt(bytes.length);
    out.write(bytes);
    out.writeDouble(weight);
  } 
   
  @Override 
  public void readFields(DataInput in) throws IOException {
    this.bytes = new byte[in.readInt()];
    in.readFully(this.bytes);
    weight = in.readDouble();
  } 
   
  // Comparable 
  @Override 
  public int compareTo(Key other) {
8
CodeRank
This code example shows how to use the following methods:writeByte
    masterKeyId = WritableUtils.readVInt(in);
  } 
 
  @VisibleForTesting 
  void writeImpl(DataOutput out) throws IOException {
    out.writeByte(VERSION);
    owner.write(out);
    renewer.write(out);
    realUser.write(out);
    WritableUtils.writeVLong(out, issueDate);
    WritableUtils.writeVLong(out, maxDate);
    WritableUtils.writeVInt(out, sequenceNumber);
    WritableUtils.writeVInt(out, masterKeyId);
  } 
   
  @Override 
  public void write(DataOutput out) throws IOException {
    if (owner.getLength() > Text.DEFAULT_MAX_LEN) {
      throw new IOException("owner is too long to be serialized!");
    } 
8
CodeRank
This code example shows how to use the following methods:writeByte
        this.out = out;
    } 
 
    @Override 
    public void writeByte(byte b) throws IOException {
        out.writeByte(b);
    } 
 
    @Override 
    public void writeBytes(byte[] b, int offset, int length) throws IOException {
        out.write(b, offset, length);
    } 
 
    @Override 
    public void flush() throws IOException { 
        // nothing to do there... 
    } 
 
    @Override 
    public void reset() throws IOException { 
8
CodeRank
This code example shows how to use the following methods:writeInt
     * 
     * @param outstream the output stream 
     * @throws Exception 
     */ 
    public void writeTo(DataOutput outstream) throws Exception {
        S3Util.writeString(host, outstream);
        outstream.writeInt(port);
    } 
 
    /** 
     * Read the domain controller's data from an input stream. 
     * 
     * @param instream the input stream 
     * @throws Exception 
     */ 
    public void readFrom(DataInput instream) throws Exception {
        host = S3Util.readString(instream);
        port = instream.readInt();
    } 
 
8
CodeRank
This code example shows how to use the following methods:writeBoolean
    } 
  } 
 
  @Override 
  public void write(DataOutput output) throws IOException {
    super.write(output);
    output.writeBoolean(hint != null);
    if (hint != null) {
      hint.write(output);
    } 
  } 
} 
8
CodeRank

Related Java 8 DataOutput Questions & Answers:

See Code Examples for Java 8 DataOutput Methods: