Package java.io

Examples of java.io.DataInputStream.readFloat()


                                        .intBitsToFloat(((input[3] & 0xFF) << 24)
                                                | ((input[2] & 0xFF) << 16)
                                                | ((input[1] & 0xFF) << 8)
                                                | (input[0] & 0xFF));
                            } else {
                                x = in.readFloat();
                                y = in.readFloat();
                            }

                            pointCount++;
                            connected = _addLegendIfNecessary(connected);
View Full Code Here


                                                | ((input[2] & 0xFF) << 16)
                                                | ((input[1] & 0xFF) << 8)
                                                | (input[0] & 0xFF));
                            } else {
                                x = in.readFloat();
                                y = in.readFloat();
                            }

                            pointCount++;
                            connected = _addLegendIfNecessary(connected);
                            _plot.addPoint(_currentdataset, x, y, connected);
View Full Code Here

      recordStore = RecordStore.openRecordStore("locationPrefer", false);
            byte[] bytes = recordStore.getRecord(1);
            ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
            inputStream = new DataInputStream(bais);
            location = inputStream.readUTF();
            latitude = inputStream.readFloat();
            longitude = inputStream.readFloat();      
            timeZoneSrc=inputStream.readByte();
            timeZoneMin = inputStream.readShort();
            isDSTOn=inputStream.readBoolean();
            altitude=inputStream.readShort();
View Full Code Here

            byte[] bytes = recordStore.getRecord(1);
            ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
            inputStream = new DataInputStream(bais);
            location = inputStream.readUTF();
            latitude = inputStream.readFloat();
            longitude = inputStream.readFloat();      
            timeZoneSrc=inputStream.readByte();
            timeZoneMin = inputStream.readShort();
            isDSTOn=inputStream.readBoolean();
            altitude=inputStream.readShort();
            temperature=inputStream.readShort();
View Full Code Here

    }

    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

    }

    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

          if ("d".equals(dataType)) {
            double dv = input.readDouble();
            LOG.info("metrics " + name + " value:" + dv);
            record.add(new Metric<Double>(name, dv));
          } else if ("f".equals(dataType)) {
            float fv = input.readFloat();
            LOG.info("metrics " + name + " value:" + fv);
            record.add(new Metric<Float>(name, fv));
          } else if ("i".equals(dataType)) {
            int iv = input.readInt();
            LOG.info("metrics " + name + " value:" + iv);
View Full Code Here

    }

    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

  public static float[] readFloat(String file, int first, int skipBytes, int length) throws IOException{
    float[] data = new float[length];
    DataInputStream in = new DataInputStream(new FileInputStream(file));
    //find the first double to read in
    in.skipBytes(first);
    data[0] = in.readFloat();
    for(int i=1; i<length; ++i){
      in.skipBytes(skipBytes);
      data[i] = in.readFloat();
    }
    in.close();
View Full Code Here

    //find the first double to read in
    in.skipBytes(first);
    data[0] = in.readFloat();
    for(int i=1; i<length; ++i){
      in.skipBytes(skipBytes);
      data[i] = in.readFloat();
    }
    in.close();
    return data;
  }
 
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.