DataInput readInt - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:readFully, readInt, readUTF
    } 
 
    @Override 
    public AddressableNode readObject(ObjectInput input) throws IOException {
        try { 
            Address jgroupsAddress = org.jgroups.util.Util.readAddress(input);
            String name = input.readUTF();
            byte[] address = new byte[input.readInt()];
            input.readFully(address);
            int port = input.readInt();
            return new AddressableNode(jgroupsAddress, name, new InetSocketAddress(InetAddress.getByAddress(address), port));
        } catch (IOException e) {
            throw e;
        } catch (Exception e) {
            throw new IOException(e);
        } 
    } 
 
    @Override 
    public void writeObject(ObjectOutput output, AddressableNode node) throws IOException {
9
CodeRank
This code example shows how to use the following methods:readFully, readInt, readUTF
        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:readFully, readInt
        output.write(encoded);
    } 
 
    @Override 
    public SessionID readObject(ObjectInput input) throws IOException {
        byte[] encoded = new byte[input.readInt()];
        input.readFully(encoded);
        return SessionID.createSessionID(encoded);
    } 
} 
8
CodeRank
This code example shows how to use the following methods:readInt
        out.writeInt(this.hashCode);
    } 
 
    @Override 
    public void readExternal(ObjectInput in) throws IOException {
        super.readExternal(in);
        this.hashCode = in.readInt();
    } 
} 
8
CodeRank
This code example shows how to use the following methods:readInt, readLong
        output.writeInt((int) metaData.getMaxInactiveInterval(TimeUnit.SECONDS));
    } 
 
    @Override 
    public SimpleSessionMetaData readObject(ObjectInput input) throws IOException {
        Date creationTime = new Date(input.readLong());
        Date lastAccessedTime = new Date(input.readLong());
        Time maxInactiveInterval = new Time(input.readInt(), TimeUnit.SECONDS);
        return new SimpleSessionMetaData(creationTime, lastAccessedTime, maxInactiveInterval);
    } 
} 
8
CodeRank
This code example shows how to use the following methods:readDouble, readInt
    return loChild.toString() + ',' + hiChild.toString(); 
  } 
   
  @Override 
  public void readFields(DataInput in) throws IOException {
    attr = in.readInt();
    split = in.readDouble();
    loChild = Node.read(in);
    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:readInt
        bytesRead += b.length;
    } 
 
    public int readInt() throws IOException 
    { 
        int i = source.readInt();
        bytesRead += 4;
        return i;
    } 
 
    public String readLine() throws IOException
    { 
        // since this method is deprecated and cannot track bytes read 
        // just throw exception 
        throw new UnsupportedOperationException();
    } 
 
    public long readLong() throws IOException 
    { 
        long l = source.readLong();
7
CodeRank
This code example shows how to use the following methods:readInt
    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);
    } 
  } 
 
  @Override 
  public void close() { 
      // This is an online classifier, nothing to do. 
  } 
 
7
CodeRank
This code example shows how to use the following methods:readInt
     * @param o the object to un-marshal 
     * @param dataIn the data input stream to build the object from 
     * @throws IOException 
     */ 
    public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
        super.tightUnmarshal(wireFormat, o, dataIn, bs);
 
        BaseCommand info = (BaseCommand)o;
        info.setCommandId(dataIn.readInt());
        info.setResponseRequired(bs.readBoolean());
 
    } 
 
 
    /** 
     * Write the booleans that this object uses to a BooleanStream 
     */ 
    public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
 
        BaseCommand info = (BaseCommand)o;
7
CodeRank
This code example shows how to use the following methods:readFully, readInt
    txt.write(out);
  } 
 
  @Override 
  public void readFields(DataInput in) throws IOException {
    a = in.readInt();
    final int length = in.readInt();
    array = new byte[length];
    in.readFully(array);
    longWritable.readFields(in);
    txt.readFields(in);
  } 
} 
7
CodeRank
readInt Method Overview
Reads four input bytes and returns an int value.
See Code Examples for other Java 8 DataInput Methods: