Package com.google.code.fqueue.exception

Examples of com.google.code.fqueue.exception.FileFormatException


      readerIndex = 1;
      writerIndex = 1;
    } else {
      dbRandFile = new RandomAccessFile(dbFile, "rwd");
      if (dbRandFile.length() < 32) {
        throw new FileFormatException("file format error");
      }
      byte[] b = new byte[this.dbFileLimitLength];
      dbRandFile.read(b);
      ByteBuffer buffer = ByteBuffer.wrap(b);
      b = new byte[LogEntity.MAGIC.getBytes().length];
View Full Code Here


      createLogEntity();
      FileRunner.addCreateFile(Integer.toString(fileNumber + 1));
    } else {
      raFile = new RandomAccessFile(file, "rwd");
      if (raFile.length() < LogEntity.messageStartPosition) {
        throw new FileFormatException("file format error");
      }
      fc = raFile.getChannel();
      mappedByteBuffer = fc.map(MapMode.READ_WRITE, 0,
          this.fileLimitLength);
      // magicString
      byte[] b = new byte[8];
      mappedByteBuffer.get(b);
      magicString = new String(b);
      if (magicString.equals(MAGIC) == false) {
        throw new FileFormatException("file format error");
      }
      // version
      version = mappedByteBuffer.getInt();
      // nextfile
      nextFile = mappedByteBuffer.getInt();
View Full Code Here

TOP

Related Classes of com.google.code.fqueue.exception.FileFormatException

Copyright © 2018 www.massapicom. 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.