Package java.io

Examples of java.io.RandomAccessFile.writeLong()


  void write(FlumeEventQueue queue) throws IOException {
    LOG.info("Writing checkoint to " + file + ", size = " + queue.size());
    RandomAccessFile dataOutput = new RandomAccessFile(file, "rw");
    try {
      // write out a small number
      dataOutput.writeLong(Long.MIN_VALUE);
      // write a the queue itself
      dataOutput.writeInt(queue.getCapacity());
      queue.write(dataOutput);
      // force all changes to disk
      dataOutput.getChannel().force(true);
View Full Code Here


      queue.write(dataOutput);
      // force all changes to disk
      dataOutput.getChannel().force(true);
      // now update the timestamp saying we are successful
      dataOutput.seek(OFFSET_TIMESTAMP);
      dataOutput.writeLong(timestamp = System.currentTimeMillis());
      dataOutput.getChannel().force(true);
      dataOutput.close();
    } finally {
      if(dataOutput != null) {
        try {
View Full Code Here

    try {
      Files.copy(imageFile, tmpFile);
      RandomAccessFile raf = new RandomAccessFile(tmpFile, "rw");
      try {
        raf.seek(IMAGE_TXID_POS);
        raf.writeLong(0);
      } finally {
        IOUtils.closeStream(raf);
      }
      return getFileMD5(tmpFile);
    } finally {
View Full Code Here

    try {
      Files.copy(imageFile, tmpFile);
      RandomAccessFile raf = new RandomAccessFile(tmpFile, "rw");
      try {
        raf.seek(IMAGE_TXID_POS);
        raf.writeLong(0);
      } finally {
        IOUtils.closeStream(raf);
      }
      return getFileMD5(tmpFile);
    } finally {
View Full Code Here

    try {
      Files.copy(imageFile, tmpFile);
      RandomAccessFile raf = new RandomAccessFile(tmpFile, "rw");
      try {
        raf.seek(IMAGE_TXID_POS);
        raf.writeLong(0);
      } finally {
        IOUtils.closeStream(raf);
      }
      return getFileMD5(tmpFile);
    } finally {
View Full Code Here

                break;
            case LoadCorrupt:
                // loadable but invalid metadata
                // location of order index low priority index for first destination...
                raf.seek(8*1024 + 57);
                raf.writeLong(Integer.MAX_VALUE-10);
                break;
            default:
        }
        raf.close();

View Full Code Here

     * @tests java.io.RandomAccessFile#readLong()
     */
    public void test_readLong() throws IOException {
        // Test for method long java.io.RandomAccessFile.readLong()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeLong(Long.MAX_VALUE);
        raf.seek(0);
        assertEquals("Incorrect long read/written", Long.MAX_VALUE, raf
                .readLong());
        raf.close();
    }
View Full Code Here

     * @tests java.io.RandomAccessFile#writeLong(long)
     */
    public void test_writeLongJ() throws IOException {
        // Test for method void java.io.RandomAccessFile.writeLong(long)
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeLong(Long.MAX_VALUE);
        raf.seek(0);
        assertEquals("Incorrect long read/written", Long.MAX_VALUE, raf
                .readLong());
        raf.close();
    }
View Full Code Here

     * @tests java.io.RandomAccessFile#readLong()
     */
    public void test_readLong() throws IOException {
        // Test for method long java.io.RandomAccessFile.readLong()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeLong(Long.MAX_VALUE);
        raf.seek(0);
        assertEquals("Incorrect long read/written", Long.MAX_VALUE, raf
                .readLong());
        raf.close();
    }
View Full Code Here

     * @tests java.io.RandomAccessFile#writeLong(long)
     */
    public void test_writeLongJ() throws IOException {
        // Test for method void java.io.RandomAccessFile.writeLong(long)
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeLong(Long.MAX_VALUE);
        raf.seek(0);
        assertEquals("Incorrect long read/written", Long.MAX_VALUE, raf
                .readLong());
        raf.close();
    }
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.