Exemplo n.º 1
0
 /** {@inheritDoc} */
 public double readDouble() throws IOException {
   fileSize -= 8;
   if (fileSize < 0) {
     throw new EOFException();
   }
   return dataInput.readDouble();
 }
Exemplo n.º 2
0
 static void display() throws IOException {
   RandomAccessFile rf = new RandomAccessFile(file, "r");
   for (int i = 0; i < 7; i++) {
     System.out.println("Value " + i + " : " + rf.readDouble());
   }
   System.out.println(rf.readUTF());
   rf.close();
 }
Exemplo n.º 3
0
  public static void main(String[] args) throws Exception {
    RandomAccessFile randomAccessFile = new RandomAccessFile("ratest.dat", "rw");
    for (int i = 0; i < 5; i++) {
      randomAccessFile.writeDouble(i * 1.44);
    }
    randomAccessFile.close();
    ;

    randomAccessFile = new RandomAccessFile("ratest.dat", "rw");
    randomAccessFile.seek(2 * 8);

    randomAccessFile.writeDouble(48.123);
    randomAccessFile.close();

    randomAccessFile = new RandomAccessFile("ratest.dat", "rw");
    for (int i = 0; i < 5; i++) {
      System.out.println(randomAccessFile.readDouble());
    }
    randomAccessFile.close();
  }
Exemplo n.º 4
0
 /** This reads a binary double from the file. */
 public double readBinaryDouble(int col, int row) throws IOException {
   raf.seek(row * nBytesPerRow + columnStartAt[col]);
   return raf.readDouble();
 }
Exemplo n.º 5
0
 /* @see java.io.DataInput.readDouble() */
 public double readDouble() throws IOException {
   return raf.readDouble();
 }