Package java.io

Examples of java.io.DataInputStream.readFloat()


    @Override
    public Float bytesToFloat(byte[] b) {
        DataInputStream dis = new DataInputStream(new ByteArrayInputStream(b));
        try {
            return new Float(dis.readFloat());
        } catch (IOException e) {
            LogUtils.warn(this, "Unable to convert bytearray to float, " +
                    "caught IOException <" + e.getMessage() + ">",
                    PigWarning.FIELD_DISCARDED_TYPE_CONVERSION_FAILED,
                    mLog);
View Full Code Here


        case EMBEDDEDLIST:
          break;
        case EMBEDDEDSET:
          break;
        case FLOAT:
          value = in.readFloat();
          break;
        case INTEGER:
          value = in.readInt();
          break;
        case LINK:
View Full Code Here

        case EMBEDDEDLIST:
          break;
        case EMBEDDEDSET:
          break;
        case FLOAT:
          value = in.readFloat();
          break;
        case INTEGER:
          value = in.readInt();
          break;
        case LINK:
View Full Code Here

      DataInputStream dis = new DataInputStream(fis);

      for (int n = 0; n < nsize; n++) {
        for (int k = 0; k < nsave; k++)
          //data[nelem * n + k] = dis.readShort() / 100f;
          data[nelem * n + k] = dis.readFloat();
        if (dis.available() <= 2)
          break;
      }

      fis.close();
View Full Code Here

            // make sure the contents are really the same
            ByteArrayInputStream bytesIn = new ByteArrayInputStream(inboundPacket.getData());
            DataInputStream dataIn = new DataInputStream(bytesIn);
            // the delta is only here to make JUnit happy
            assertEquals(1.0f, dataIn.readFloat(), 0.1f);
            assertEquals(2.0f, dataIn.readFloat(), 0.1f);
        }
        finally
        {
            try
View Full Code Here

            // make sure the contents are really the same
            ByteArrayInputStream bytesIn = new ByteArrayInputStream(inboundPacket.getData());
            DataInputStream dataIn = new DataInputStream(bytesIn);
            // the delta is only here to make JUnit happy
            assertEquals(1.0f, dataIn.readFloat(), 0.1f);
            assertEquals(2.0f, dataIn.readFloat(), 0.1f);
        }
        finally
        {
            try
            {
View Full Code Here

        // make sure the contents are really the same
        ByteArrayInputStream bytesIn = new ByteArrayInputStream(inboundPacket.getData());
        DataInputStream dataIn = new DataInputStream(bytesIn);
        // the delta is only here to make JUnit happy
        assertEquals(1.0f, dataIn.readFloat(), 0.1f);
        assertEquals(2.0f, dataIn.readFloat(), 0.1f);
    }

}
View Full Code Here

        // make sure the contents are really the same
        ByteArrayInputStream bytesIn = new ByteArrayInputStream(inboundPacket.getData());
        DataInputStream dataIn = new DataInputStream(bytesIn);
        // the delta is only here to make JUnit happy
        assertEquals(1.0f, dataIn.readFloat(), 0.1f);
        assertEquals(2.0f, dataIn.readFloat(), 0.1f);
    }

}
View Full Code Here

//      if (this.received_hsid_packet == false)
//        logger.fine("Received first HSID packet");
     
      DataInputStream data_stream = new DataInputStream(new ByteArrayInputStream(sim_data));   
      data_stream.skipBytes(4)// skip the bytes containing the packet type id
      int nb_of_data_points = (int) data_stream.readFloat();
     
      // Reads the HSID data und deploys them into the data repository
      for (int i=0;i<nb_of_data_points;i++) {
        int data_point_id = (int) data_stream.readFloat();
        this.xplane_data_repository.store_sim_value(data_point_id, data_stream.readFloat());
View Full Code Here

      data_stream.skipBytes(4)// skip the bytes containing the packet type id
      int nb_of_data_points = (int) data_stream.readFloat();
     
      // Reads the HSID data und deploys them into the data repository
      for (int i=0;i<nb_of_data_points;i++) {
        int data_point_id = (int) data_stream.readFloat();
        this.xplane_data_repository.store_sim_value(data_point_id, data_stream.readFloat());
      }
     
     
      if (this.received_hsid_packet == false) {       
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.