Пример #1
0
 public static void main(String[] args) throws IOException {
   RandomAccessFile rf = new RandomAccessFile(file, "rw");
   for (int i = 0; i < 7; i++) {
     rf.writeDouble(i * 1.414);
   }
   rf.writeUTF("The end of the file.");
   rf.close();
   display();
   rf = new RandomAccessFile(file, "rw");
   rf.seek(5 * 8);
   rf.writeDouble(47.0001);
   rf.close();
   display();
 }
Пример #2
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();
  }
Пример #3
0
 /**
  * This writes the binary double to the file. Later, use readBinaryDouble to read the value from
  * the file.
  */
 public void writeBinaryDouble(int col, int row, double d) throws IOException {
   raf.seek(row * nBytesPerRow + columnStartAt[col]);
   raf.writeDouble(d);
 }
Пример #4
0
 /* @see java.io.DataOutput.writeDouble(double) */
 public void writeDouble(double v) throws IOException {
   raf.writeDouble(v);
 }