Package java.io

Examples of java.io.DataInputStream.readDouble()


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


    //find the first double to read in
    in.skipBytes(first);
    data[0] = in.readDouble();
    for(int i=1; i<length; ++i){
      in.skipBytes(skipBytes);
      data[i] = in.readDouble();
    }
    in.close();
    return data;
  }
 
View Full Code Here

   */
  public static double[] readDouble(String file) throws IOException{
    ArrayList<Double> data = new ArrayList<Double>(1000);
    DataInputStream in = new DataInputStream(new FileInputStream(file));
    while(in.available()>0){
      data.add(in.readDouble());
    }
    in.close();
    double[] doubleData = new double[data.size()];
    for(int i=0; i<doubleData.length; ++i){
      doubleData[i] = data.get(i);
View Full Code Here

 
  private static double[][] readDoubleByRow(String file, int first, int skipBytes,int rowNumber, int columnNumber) throws IOException{
    DataInputStream in = new DataInputStream(new FileInputStream(file));
    double[][] data = new double[rowNumber][columnNumber];
    in.skipBytes(first);
    data[0][0] = in.readDouble();
    for(int colIndex=1; colIndex<columnNumber; ++colIndex){
      in.skipBytes(skipBytes);
      data[0][colIndex] = in.readDouble();
    }
    for(int rowIndex=1; rowIndex<rowNumber; ++rowIndex){
View Full Code Here

    double[][] data = new double[rowNumber][columnNumber];
    in.skipBytes(first);
    data[0][0] = in.readDouble();
    for(int colIndex=1; colIndex<columnNumber; ++colIndex){
      in.skipBytes(skipBytes);
      data[0][colIndex] = in.readDouble();
    }
    for(int rowIndex=1; rowIndex<rowNumber; ++rowIndex){
      for(int colIndex=0; colIndex<columnNumber; ++colIndex){
        in.skipBytes(skipBytes);
        data[rowIndex][colIndex] = in.readDouble();
View Full Code Here

      data[0][colIndex] = in.readDouble();
    }
    for(int rowIndex=1; rowIndex<rowNumber; ++rowIndex){
      for(int colIndex=0; colIndex<columnNumber; ++colIndex){
        in.skipBytes(skipBytes);
        data[rowIndex][colIndex] = in.readDouble();
      }
    }
    in.close();
    return data;
  }
View Full Code Here

 
  private static double[][] readDoubleByColumn(String file, int first, int skipBytes,int rowNumber, int columnNumber) throws IOException{
    DataInputStream in = new DataInputStream(new FileInputStream(file));
    double[][] data = new double[rowNumber][columnNumber];
    in.skipBytes(first);
    data[0][0] = in.readDouble();
    for(int rowIndex=1; rowIndex<rowNumber; ++rowIndex){
      in.skipBytes(skipBytes);
      data[rowIndex][0] = in.readDouble();
    }
    for(int colIndex=1; colIndex<columnNumber; ++colIndex){
View Full Code Here

    double[][] data = new double[rowNumber][columnNumber];
    in.skipBytes(first);
    data[0][0] = in.readDouble();
    for(int rowIndex=1; rowIndex<rowNumber; ++rowIndex){
      in.skipBytes(skipBytes);
      data[rowIndex][0] = in.readDouble();
    }
    for(int colIndex=1; colIndex<columnNumber; ++colIndex){
      for(int rowIndex=0; rowIndex<rowNumber; ++rowIndex){
        in.skipBytes(skipBytes);
        data[rowIndex][colIndex] = in.readDouble();
View Full Code Here

      data[rowIndex][0] = in.readDouble();
    }
    for(int colIndex=1; colIndex<columnNumber; ++colIndex){
      for(int rowIndex=0; rowIndex<rowNumber; ++rowIndex){
        in.skipBytes(skipBytes);
        data[rowIndex][colIndex] = in.readDouble();
      }
    }
    in.close();
    return data;
  }
View Full Code Here

        DataInputStream input = null;
        try {
          String name = removeSuffix(child);
          input = new DataInputStream(new ByteArrayInputStream(dataInBytes));
          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);
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.