Code example for DataInputStream

Methods: readByte, readFloat

0
        return ID;
    } 
 
    @Override 
    public void decode( DataInputStream in ) throws IOException {
        yaw      = in.readFloat();
        pitch    = in.readFloat();
        onGround = in.readByte()!=0;
    } 
 
    @Override 
    public void encode( DataOutputStream out ) throws IOException {
        out.writeFloat( yaw );
        out.writeFloat( pitch );
        out.write( onGround ? 1 : 0);
    } 
 
    public float getYaw() { 
        return yaw;
    }