DataOutput writeInt - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for DataOutput writeInt method.

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: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:write, writeInt
      writeCompressed(dout);
      dout.close();
      deflater.end();
      compressed = deflated.toByteArray();
    } 
    out.writeInt(compressed.length);
    out.write(compressed);
  } 
 
  /** Subclasses implement this instead of {@link #write(DataOutput)}. */ 
  protected abstract void writeCompressed(DataOutput out) throws IOException;
 
} 
7
CodeRank
This code example shows how to use the following methods:writeInt, writeUTF, write
    } 
 
    @Override 
    public void writeObject(ObjectOutput output, ClientMapping mapping) throws IOException {
        byte[] address = mapping.getSourceNetworkAddress().getAddress();
        output.writeInt(address.length);
        output.write(address);
        output.writeInt(mapping.getSourceNetworkMaskBits());
        output.writeUTF(mapping.getDestinationAddress());
        output.writeInt(mapping.getDestinationPort());
    } 
 
    @Override 
    public ClientMapping readObject(ObjectInput input) throws IOException {
        byte[] sourceAddress = new byte[input.readInt()];
        input.readFully(sourceAddress);
        int sourcePort = input.readInt();
        String destAddress = input.readUTF();
        int destPort = input.readInt();
        return new ClientMapping(InetAddress.getByAddress(sourceAddress), sourcePort, destAddress, destPort);
8
CodeRank
This code example shows how to use the following methods:writeDouble, writeInt
    hiChild = Node.read(in);
  } 
   
  @Override 
  protected void writeNode(DataOutput out) throws IOException {
    out.writeInt(attr);
    out.writeDouble(split);
    loChild.write(out);
    hiChild.write(out);
  } 
} 
7
CodeRank
This code example shows how to use the following methods:writeInt, writeLong
  } 
 
  @Override 
  public void write(DataOutput out) throws IOException {
    ApplicationId appId = this.applicationAttemptId.getApplicationId();
    out.writeLong(appId.getClusterTimestamp());
    out.writeInt(appId.getId());
    out.writeInt(this.applicationAttemptId.getAttemptId());
  } 
 
  @Override 
  public void readFields(DataInput in) throws IOException {
    long clusterTimeStamp = in.readLong();
    int appId = in.readInt();
    int attemptId = in.readInt();
    ApplicationId applicationId =
        ApplicationId.newInstance(clusterTimeStamp, appId);
    this.applicationAttemptId =
        ApplicationAttemptId.newInstance(applicationId, attemptId);
  } 
7
CodeRank
This code example shows how to use the following methods:writeBoolean, writeInt, writeUTF
    } 
  } 
 
  @Override 
  public void write(DataOutput output) throws IOException {
    output.writeInt(partitionId);
    workerInfo.write(output);
    if (previousWorkerInfo != null) {
      output.writeBoolean(true);
      previousWorkerInfo.write(output);
    } else { 
      output.writeBoolean(false);
    } 
    if (checkpointFilesPrefix != null) {
      output.writeBoolean(true);
      output.writeUTF(checkpointFilesPrefix);
    } else { 
      output.writeBoolean(false);
    } 
  } 

7
CodeRank
This code example shows how to use the following methods:writeInt, writeLong
    mode = CWritableUtils.readString(in);
  } 
 
  @Override 
  public void write(DataOutput out) throws IOException {
    out.writeInt(version);  
    CWritableUtils.writeString(out, path);
    out.writeInt(type);
    out.writeLong(date);
    out.writeLong(length);
    CWritableUtils.writeString(out, user);
    CWritableUtils.writeString(out, group);
    CWritableUtils.writeString(out, mode);
  } 
   
  public int getVersion() { 
    return version;
  } 
  public void setVersion(int version) {
    this.version = version;
7
CodeRank
This code example shows how to use the following methods:writeInt
    return getClass().getSimpleName() + "." + root.getLocalName() + "(id=" + id + ")";
  } 
   
  /** Serialize the fields to out */ 
  void write(DataOutput out) throws IOException {
    out.writeInt(id);
    // write root 
    FSImageSerialization.writeINodeDirectory(root, out);
  } 
} 
7
CodeRank
writeInt Method Overview
Writes an int value, which is comprised of four bytes, to the output stream.
See Code Examples for other Java 8 DataOutput Methods: