Exemple #1
0
  public void parse(ByteBuffer is) {
    super.parse(is);
    if ((flags & 0x1) != 0) // self ref
    return;
    type = NIOUtils.readString(is, 4);
    recordSize = is.getShort();
    version = is.getShort();
    kind = is.getShort();
    volumeName = NIOUtils.readPascalStringL(is, 27);
    volumeCreateDate = is.getInt();
    volumeSignature = is.getShort();
    volumeType = is.getShort();
    parentDirId = is.getInt();
    fileName = NIOUtils.readPascalStringL(is, 63);
    fileNumber = is.getInt();
    createdLocalDate = is.getInt();
    fileTypeName = NIOUtils.readString(is, 4);
    creatorName = NIOUtils.readString(is, 4);
    nlvlFrom = is.getShort();
    nlvlTo = is.getShort();
    volumeAttributes = is.getInt();
    fsId = is.getShort();
    NIOUtils.skip(is, 10);

    extra = new ArrayList<ExtraField>();
    while (true) {
      short type = is.getShort();
      if (type == -1) break;
      int len = is.getShort();
      byte[] bs = NIOUtils.toArray(NIOUtils.read(is, (len + 1) & 0xfffffffe));
      if (bs == null) break;
      extra.add(new ExtraField(type, len, bs));
    }
  }
Exemple #2
0
 protected void doWrite(ByteBuffer out) {
   super.doWrite(out);
   if ((flags & 0x1) != 0) // self ref
   return;
   out.put(asciiString(type), 0, 4);
   out.putShort(recordSize);
   out.putShort(version);
   out.putShort(kind);
   NIOUtils.writePascalStringL(out, volumeName, 27);
   out.putInt(volumeCreateDate);
   out.putShort(volumeSignature);
   out.putShort(volumeType);
   out.putInt(parentDirId);
   NIOUtils.writePascalStringL(out, fileName, 63);
   out.putInt(fileNumber);
   out.putInt(createdLocalDate);
   out.put(asciiString(fileTypeName), 0, 4);
   out.put(asciiString(creatorName), 0, 4);
   out.putShort(nlvlFrom);
   out.putShort(nlvlTo);
   out.putInt(volumeAttributes);
   out.putShort(fsId);
   out.put(new byte[10]);
   for (ExtraField extraField : extra) {
     out.putShort(extraField.type);
     out.putShort((short) extraField.len);
     out.put(extraField.data);
   }
   out.putShort((short) -1);
   out.putShort((short) 0);
 }
  @Override
  protected int load(DataInputStream fin) throws IOException {
    super.load(fin);
    if (this.getVersion() == 1) {
      this.creationTime = readU64(fin);
      this.modificationTime = readU64(fin);
      this.timescale = readU64(fin);
      this.duration = read64(fin);
    } else {
      this.creationTime = readU32(fin);
      this.modificationTime = readU32(fin);
      this.timescale = readU32(fin);
      this.duration = readU32(fin);
    }

    language = read16(fin);
    fin.readByte();
    fin.readByte();

    return (int) getSize();
  }
Exemple #4
0
 public void parse(IsoInputStream in, long size, BoxFactory boxFactory, Box lastMovieFragmentBox)
     throws IOException {
   super.parse(in, size, boxFactory, lastMovieFragmentBox);
   language = in.readIso639();
   title = in.readString();
 }