示例#1
0
 public String computeDataSizeAndType(RandomAccessFile fin) throws IOException {
   SinAddr a = map.get(0);
   byte[] res = new byte[(int) a.getDataLength()];
   fin.seek(getDataHeaderSize() + map.getSize() + a.getSrcOffset());
   fin.read(res);
   byte[] magic = new byte[4];
   int pos = 0;
   while (res[pos] == 0) pos++;
   int startpos = pos;
   pos = 0;
   System.arraycopy(res, startpos + pos, magic, 0, magic.length);
   if (new String(magic).contains("ELF")) return "elf";
   while (!HexDump.toHex(magic).startsWith("[FF, FF, 53, EF")) {
     pos++;
     try {
       System.arraycopy(res, startpos + pos, magic, 0, magic.length);
     } catch (Exception e) {
       return "unknown";
     }
     if (new String(magic).contains("ELF")) return "elf";
   }
   // if (pos>=500) return "unknown";
   pos = pos - 54;
   byte[] header = new byte[58];
   System.arraycopy(res, startpos + pos, header, 0, header.length);
   byte[] bcount = new byte[4];
   System.arraycopy(header, 4, bcount, 0, bcount.length);
   BytesUtil.revert(bcount);
   long blockcount = BytesUtil.getInt(bcount);
   outputsize = blockcount * 4L * 1024L;
   return "ext4";
 }
示例#2
0
 public void addAddr(SinAddr addr) {
   map.put(map.size(), addr);
 }
示例#3
0
 public int getDataOffset() {
   return getDataHeaderSize() + map.getSize();
 }
示例#4
0
 public long getOutputSize() {
   if (outputsize > 0L) return outputsize;
   return map.get(map.size() - 1).getDestOffset() + map.get(map.size() - 1).getDataLength();
 }