Examples of FileHeader


Examples of entagged.audioformats.asf.data.FileHeader

   * @param raf
   * @return <code>null</code> if no valid file header object.
   * @throws IOException
   */
  private FileHeader parseData(RandomAccessFile raf) throws IOException {
    FileHeader result = null;
    long fileHeaderStart = raf.getFilePointer();
    GUID guid = Utils.readGUID(raf);
    if (GUID.GUID_FILE.equals(guid)) {
      BigInteger chunckLen = Utils.readBig64(raf);
      // Skip client GUID.
      raf.skipBytes(16);

      BigInteger fileSize = Utils.readBig64(raf);
      if (fileSize.intValue() != raf.length()) {
        System.err
            .println("Filesize of file doesn't match len of Fileheader. ("
                + fileSize.toString() + ", file: "+raf.length()+")");
      }
      // fileTime in 100 ns since midnight of 1st january 1601 GMT
      BigInteger fileTime = Utils.readBig64(raf);

      BigInteger packageCount = Utils.readBig64(raf);

      BigInteger timeEndPos = Utils.readBig64(raf);
      BigInteger duration = Utils.readBig64(raf);
      BigInteger timeStartPos = Utils.readBig64(raf);

      long flags = Utils.readUINT32(raf);

      long minPkgSize = Utils.readUINT32(raf);
      long maxPkgSize = Utils.readUINT32(raf);
      long uncompressedFrameSize = Utils.readUINT32(raf);

      result = new FileHeader(fileHeaderStart, chunckLen, fileSize,
          fileTime, packageCount, duration, timeStartPos, timeEndPos,
          flags, minPkgSize, maxPkgSize, uncompressedFrameSize);
    }
    return result;
  }
View Full Code Here

Examples of entagged.audioformats.asf.data.FileHeader

      /*
       * Now we know all positions and guids of chunks which are contained
       * whithin asf header. Further we need to identify the type of those
       * chunks and parse the interesting ones.
       */
      FileHeader fileHeader = null;
      ExtendedContentDescription extendedDescription = null;
      EncodingChunk encodingChunk = null;
      StreamChunk streamChunk = null;
      ContentDescription contentDescription = null;
      StreamBitratePropertiesChunk bitratePropertiesChunk = null;
View Full Code Here

Examples of net.lingala.zip4j.model.FileHeader

      ZipModel model = r.readAllHeaders();
      model.setZipFile(tmp.getAbsolutePath());
      Map<String, Object> map = zipFile.serialize();
      List<?> fhs = model.getCentralDirectory().getFileHeaders();
      for (Object _fh : fhs) {
        FileHeader fh = (FileHeader) _fh;
        UnzipEngine en = new UnzipEngine(model, fh);
        // this will read the local file header
        en.getInputStream();
        LocalFileHeader lh = en.getLocalFileHeader();
View Full Code Here

Examples of org.apache.zookeeper.server.persistence.FileHeader

  {
    FileInputStream fis = new FileInputStream(snapshotPath);
    BinaryInputArchive ia = BinaryInputArchive.getArchive(fis);
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();
    DataTree dt = new DataTree();
    FileHeader header = new FileHeader();
    header.deserialize(ia, "fileheader");
    if (header.getMagic() != FileSnap.SNAP_MAGIC)
    {
      throw new IOException("mismatching magic headers " + header.getMagic()
          + " !=  " + FileSnap.SNAP_MAGIC);
    }
    SerializeUtils.deserializeSnapshot(dt, ia, sessions);

    if (bw != null)
View Full Code Here

Examples of org.apache.zookeeper.server.persistence.FileHeader

  private static void readTransactionLog(String logfilepath)
      throws FileNotFoundException, IOException, EOFException
  {
    FileInputStream fis = new FileInputStream(logfilepath);
    BinaryInputArchive logStream = BinaryInputArchive.getArchive(fis);
    FileHeader fhdr = new FileHeader();
    fhdr.deserialize(logStream, "fileheader");

    if (fhdr.getMagic() != FileTxnLog.TXNLOG_MAGIC)
    {
      System.err.println("Invalid magic number for " + logfilepath);
      System.exit(2);
    }

    if (bw != null)
    {
      bw.write("ZooKeeper Transactional Log File with dbid "
          + fhdr.getDbid() + " txnlog format version " + fhdr.getVersion());
      bw.newLine();
    } else
    {
      System.out.println("ZooKeeper Transactional Log File with dbid "
          + fhdr.getDbid() + " txnlog format version " + fhdr.getVersion());
    }

   
    int count = 0;
    while (true)
View Full Code Here

Examples of org.apache.zookeeper.server.persistence.FileHeader

  private static void readSnapshotLog(String snapshotPath) throws Exception {
    FileInputStream fis = new FileInputStream(snapshotPath);
    BinaryInputArchive ia = BinaryInputArchive.getArchive(fis);
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();
    DataTree dt = new DataTree();
    FileHeader header = new FileHeader();
    header.deserialize(ia, "fileheader");
    if (header.getMagic() != FileSnap.SNAP_MAGIC) {
      throw new IOException("mismatching magic headers " + header.getMagic() + " !=  "
          + FileSnap.SNAP_MAGIC);
    }
    SerializeUtils.deserializeSnapshot(dt, ia, sessions);

    if (bw != null) {
View Full Code Here

Examples of org.apache.zookeeper.server.persistence.FileHeader

  private static void readTransactionLog(String logfilepath) throws FileNotFoundException,
      IOException, EOFException {
    FileInputStream fis = new FileInputStream(logfilepath);
    BinaryInputArchive logStream = BinaryInputArchive.getArchive(fis);
    FileHeader fhdr = new FileHeader();
    fhdr.deserialize(logStream, "fileheader");

    if (fhdr.getMagic() != FileTxnLog.TXNLOG_MAGIC) {
      System.err.println("Invalid magic number for " + logfilepath);
      System.exit(2);
    }

    if (bw != null) {
      bw.write("ZooKeeper Transactional Log File with dbid " + fhdr.getDbid()
          + " txnlog format version " + fhdr.getVersion());
      bw.newLine();
    } else {
      System.out.println("ZooKeeper Transactional Log File with dbid " + fhdr.getDbid()
          + " txnlog format version " + fhdr.getVersion());
    }

    int count = 0;
    while (true) {
      long crcValue;
View Full Code Here

Examples of org.apache.zookeeper.server.persistence.FileHeader

        Record txn = new CreateTxn("/Test", new byte[0], null, false);
        txnLog.append(txnHeader, txn);
        FileInputStream in = new FileInputStream(tmpDir.getPath() + "/log." +
              Long.toHexString(txnHeader.getZxid()));
        BinaryInputArchive ia  = BinaryInputArchive.getArchive(in);
        FileHeader header = new FileHeader();
        header.deserialize(ia, "fileheader");
        Assert.assertTrue("Missing magic number ",
              header.getMagic() == FileTxnLog.TXNLOG_MAGIC);
    }
View Full Code Here

Examples of org.apache.zookeeper.server.persistence.FileHeader

            System.err.println("USAGE: LogFormatter log_file");
            System.exit(2);
        }
        FileInputStream fis = new FileInputStream(args[0]);
        BinaryInputArchive logStream = BinaryInputArchive.getArchive(fis);
        FileHeader fhdr = new FileHeader();
        fhdr.deserialize(logStream, "fileheader");

        if (fhdr.getMagic() != FileTxnLog.TXNLOG_MAGIC) {
            System.err.println("Invalid magic number for " + args[0]);
            System.exit(2);
        }
        System.out.println("ZooKeeper Transactional Log File with dbid "
                + fhdr.getDbid() + " txnlog format version "
                + fhdr.getVersion());

        int count = 0;
        while (true) {
            long crcValue;
            byte[] bytes;
View Full Code Here

Examples of org.apache.zookeeper.server.persistence.FileHeader

        Record txn = new CreateTxn("/Test", new byte[0], null, false, 1);
        txnLog.append(txnHeader, txn);
        FileInputStream in = new FileInputStream(tmpDir.getPath() + "/log." +
              Long.toHexString(txnHeader.getZxid()));
        BinaryInputArchive ia  = BinaryInputArchive.getArchive(in);
        FileHeader header = new FileHeader();
        header.deserialize(ia, "fileheader");
        LOG.info("Received magic : " + header.getMagic() +
              " Expected : " + FileTxnLog.TXNLOG_MAGIC);
        Assert.assertTrue("Missing magic number ",
              header.getMagic() == FileTxnLog.TXNLOG_MAGIC);
    }
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.