DataOutput writeDouble - 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 writeDouble method.

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: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:writeDouble, writeInt, writeUTF
    this.type = arg0.readUTF();
  } 
 
  @Override 
  public void write(DataOutput arg0) throws IOException {
    arg0.writeInt(i);
    arg0.writeInt(j);
    arg0.writeDouble(value);
    arg0.writeUTF(type);
  } 
 
} 
7
CodeRank
This code example shows how to use the following methods:writeDouble, writeInt
    return r;
  } 
 
  @Override 
  public void write(DataOutput out) throws IOException {
    out.writeInt(WRITABLE_VERSION);
    out.writeDouble(learningRate);
    out.writeInt(numCategories);
    MatrixWritable.writeMatrix(out, weights);
  } 
 
  @Override 
  public void readFields(DataInput in) throws IOException {
    int version = in.readInt();
    if (version == WRITABLE_VERSION) {
      learningRate = in.readDouble();
      numCategories = in.readInt();
      weights = MatrixWritable.readMatrix(in);
    } else { 
      throw new IOException("Incorrect object version, wanted " + WRITABLE_VERSION + " got " + version);
7
CodeRank
This code example shows how to use the following methods:writeDouble, writeInt
    return centroid;
  } 
 
  @Override 
  public void write(DataOutput dataOutput) throws IOException {
    dataOutput.writeInt(centroid.getIndex());
    dataOutput.writeDouble(centroid.getWeight());
    VectorWritable.writeVector(dataOutput, centroid.getVector());
  } 
 
  @Override 
  public void readFields(DataInput dataInput) throws IOException {
    if (centroid == null) {
      centroid = read(dataInput);
      return; 
    } 
    centroid.setIndex(dataInput.readInt());
    centroid.setWeight(dataInput.readDouble());
    centroid.assign(VectorWritable.readVector(dataInput));
  } 
7
CodeRank
This code example shows how to use the following methods:writeDouble
    column = CWritableUtils.readString(in);
    value = in.readDouble();
  } 
 
  public void write(DataOutput out) throws IOException {
    CWritableUtils.writeString(out, row);
    CWritableUtils.writeString(out, column);
    out.writeDouble(value);
  } 
 
  public boolean equals(Object o) {
    return compareTo(o) == 0;
  } 
   
  public int hashCode() { 
    return (row + column).toString().hashCode();
  } 
   
  public int compareTo(Object o) {
    if(o == null) {
7
CodeRank
This code example shows how to use the following methods:writeDouble
    out.writeFloat(f);
  } 
     
  @Override 
  public void writeDouble(double d, String tag) throws IOException {
    out.writeDouble(d);
  } 
     
  @Override 
  public void writeString(String s, String tag) throws IOException {
    Utils.toBinaryString(out, s);
  } 
     
  @Override 
  public void writeBuffer(Buffer buf, String tag)
    throws IOException { 
    byte[] barr = buf.get();
    int len = buf.getCount();
    Utils.writeVInt(out, len);
    out.write(barr, 0, len);
6
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);
  } 
} 
6
CodeRank
This code example shows how to use the following methods:write, writeDouble, writeInt
  } 
 
  // Writable 
 
  public void write(DataOutput out) throws IOException {
    out.writeInt(bytes.length);
    out.write(bytes);
    out.writeDouble(weight);
  } 
   
  public void readFields(DataInput in) throws IOException {
    this.bytes = new byte[in.readInt()];
    in.readFully(this.bytes);
    weight = in.readDouble();
  } 
   
  // Comparable 
   
  public int compareTo(Key other) {
    int result = this.bytes.length - other.getBytes().length;
6
CodeRank
This code example shows how to use the following methods:writeDouble, writeInt
    this.s2 = temp.get();
  } 
 
  @Override 
  public void write(DataOutput out) throws IOException {
    out.writeInt(combinerState);
    out.writeDouble(s0);
    VectorWritable.writeVector(out, s1);
    VectorWritable.writeVector(out, s2);
  } 
 
  /** 
   * @return the combinerState 
   */ 
  public int getCombinerState() { 
    return combinerState;
  } 
 
  /** 
   * @return the s0 
6
CodeRank
writeDouble Method Overview
Writes a double value, which is comprised of eight bytes, to the output stream.
See Code Examples for other Java 8 DataOutput Methods: