Package java.io

Examples of java.io.RandomAccessFile.writeLong()


            RandomAccessFile raf = getRandomAccessFile();

            // the first number in the file is the count
            m_countPosition = 0L;
            raf.seek(m_countPosition);
            raf.writeLong(m_count);

            // the second number in the file is the head pointer
            m_headPosition = raf.getFilePointer();
            raf.seek(m_headPosition);
            raf.writeLong(m_head);
View Full Code Here


            raf.writeLong(m_count);

            // the second number in the file is the head pointer
            m_headPosition = raf.getFilePointer();
            raf.seek(m_headPosition);
            raf.writeLong(m_head);

            // the third number in the file is the tail pointer
            m_tailPosition = raf.getFilePointer();
            raf.writeLong(m_tail);
View Full Code Here

            raf.seek(m_headPosition);
            raf.writeLong(m_head);

            // the third number in the file is the tail pointer
            m_tailPosition = raf.getFilePointer();
            raf.writeLong(m_tail);

            // set the file length to right after the tail pointer thus shrinking the file size down to its minimal size
            raf.setLength(raf.getFilePointer());
        }
View Full Code Here

    SortedMap<Long, Long> offsetToTxId = Maps.newTreeMap();
    File logFile = prepareUnfinalizedTestEditLog(testDir, 2, offsetToTxId);
    RandomAccessFile rwf = new RandomAccessFile(logFile, "rw");
    try {
      rwf.seek(0);
      rwf.writeLong(42); // corrupt header
    } finally {
      rwf.close();
    }
    EditLogValidation validation = EditLogFileInputStream.validateEditLog(logFile);
    assertTrue(validation.hasCorruptHeader());
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

    raf.writeInt(fileVersion);
   
    raf.writeInt(getFrameCount());
    long dict = raf.getFilePointer();
    for(int i = 0; i < getFrameCount(); i++){
      raf.writeLong(0); //initing dictionary with 0
    }
    int f = 0;
    for(Frame frame : frames){
      long current = raf.getFilePointer();
      raf.seek(dict+8*f);
 
View Full Code Here

    }
    int f = 0;
    for(Frame frame : frames){
      long current = raf.getFilePointer();
      raf.seek(dict+8*f);
      raf.writeLong(current); //write pos in dict
      raf.seek(current);
      frame.save(raf);
      f++;
    }
    raf.close();
View Full Code Here

        try {
            raf = new RandomAccessFile(logfile, "rw");

            raf.seek(TransactionLogHeader.FORMAT_ID_HEADER);
            raf.writeInt(BitronixXid.FORMAT_ID);
            raf.writeLong(System.currentTimeMillis());
            raf.writeByte(TransactionLogHeader.CLEAN_LOG_STATE);
            raf.writeLong((long) TransactionLogHeader.HEADER_LENGTH);

            byte[] buffer = new byte[4096];
            int length = (maxLogSizeInMb *1024 *1024) /4096;
View Full Code Here

            raf.seek(TransactionLogHeader.FORMAT_ID_HEADER);
            raf.writeInt(BitronixXid.FORMAT_ID);
            raf.writeLong(System.currentTimeMillis());
            raf.writeByte(TransactionLogHeader.CLEAN_LOG_STATE);
            raf.writeLong((long) TransactionLogHeader.HEADER_LENGTH);

            byte[] buffer = new byte[4096];
            int length = (maxLogSizeInMb *1024 *1024) /4096;
            for(int i=0; i<length ;i++) {
                raf.write(buffer);
View Full Code Here

      }

      @Override
      public void writeLong(long l) throws IOException
      {
        f.writeLong(l);
      }

      @Override
      public byte readByte() throws IOException
      {
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.