Package java.io

Examples of java.io.FileDescriptor.sync()


                    descriptor = access.getFD();
                }
            }

            if (descriptor != null) {
                descriptor.sync();
            }
        }
    }

    /**
 
View Full Code Here


        f.delete();
        fos = new FileOutputStream(f.getPath());
        fos.write("Test String".getBytes());
        fis = new FileInputStream(f.getPath());
        FileDescriptor fd = fos.getFD();
        fd.sync();
        int length = "Test String".length();
        assertEquals("Bytes were not written after sync", length, fis
                .available());
       
        // Regression test for Harmony-1494
View Full Code Here

        assertEquals("Bytes were not written after sync", length, fis
                .available());
       
        // Regression test for Harmony-1494
        fd = fis.getFD();
        fd.sync();
        assertEquals("Bytes were not written after sync", length, fis
                .available());
       
        RandomAccessFile raf = new RandomAccessFile(f, "r");
        fd = raf.getFD();
View Full Code Here

        assertEquals("Bytes were not written after sync", length, fis
                .available());
       
        RandomAccessFile raf = new RandomAccessFile(f, "r");
        fd = raf.getFD();
        fd.sync();
        raf.close();
  }

  /**
   * @tests java.io.FileDescriptor#valid()
View Full Code Here

                try {
                    f = new File(System.getProperty("user.dir"), "synfail.tst");
                    FileOutputStream fos = new FileOutputStream(f.getPath());
                    FileDescriptor fd = fos.getFD();
                    fos.close();
                    fd.sync();
    } catch (SyncFailedException e) {
      f.delete();
      return;
    }
View Full Code Here

     */
    public void flush() throws IOException {
  // Fix: 4636212.  When this FIleDescriptor is not valid, do nothing.
  FileDescriptor fd = file.getFD();
        if(fd.valid())
      fd.sync();
    }

    public void close() throws IOException {
        file.close();
    }
View Full Code Here

/*    */   public void flush()
/*    */     throws IOException
/*    */   {
/* 70 */     FileDescriptor fd = this.file.getFD();
/* 71 */     if (fd.valid())
/* 72 */       fd.sync();
/*    */   }
/*    */
/*    */   public void close() throws IOException {
/* 76 */     this.file.close();
/*    */   }
View Full Code Here

      {
        RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
        FileDescriptor fileDescriptor = randomAccessFile.getFD();

        randomAccessFile.write(block);
        fileDescriptor.sync();
        randomAccessFile.close();
      }

      Date end = new Date();
View Full Code Here

      Date start = new Date();

      for (int index = 0; index < numberOfCalls; index++)
      {
        randomAccessFile.write(block);
        fileDescriptor.sync();
        randomAccessFile.seek(0);
      }

      Date end = new Date();
View Full Code Here

                try {
                    f = new File(System.getProperty("user.dir"), "synfail.tst");
                    FileOutputStream fos = new FileOutputStream(f.getPath());
                    FileDescriptor fd = fos.getFD();
                    fos.close();
                    fd.sync();
    } catch (SyncFailedException e) {
      f.delete();
      return;
    }
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.