コード例 #1
0
 public Object getArrayFor(LegacyPropertyRecord propertyRecord) {
   long recordToFind = propertyRecord.getPropBlock();
   Map<Long, LegacyDynamicRecord> recordsMap = new HashMap<Long, LegacyDynamicRecord>();
   for (LegacyDynamicRecord record : readDynamicRecords(propertyRecord)) {
     recordsMap.put(record.getId(), record);
   }
   List<byte[]> byteList = new LinkedList<byte[]>();
   int totalSize = 0;
   while (recordToFind != Record.NO_NEXT_BLOCK.intValue()) {
     LegacyDynamicRecord record = recordsMap.get(recordToFind);
     if (!record.isCharData()) {
       ByteBuffer buf = ByteBuffer.wrap(record.getData());
       byte[] bytes = new byte[record.getData().length];
       totalSize += bytes.length;
       buf.get(bytes);
       byteList.add(bytes);
     } else {
       throw new InvalidRecordException("Expected byte data on record " + record);
     }
     recordToFind = record.getNextBlock();
   }
   byte[] bArray = new byte[totalSize];
   int offset = 0;
   for (byte[] currentArray : byteList) {
     System.arraycopy(currentArray, 0, bArray, offset, currentArray.length);
     offset += currentArray.length;
   }
   return arrayPropertyStore.getRightArray(bArray);
 }
コード例 #2
0
 public List<LegacyDynamicRecord> readDynamicRecords(LegacyPropertyRecord record) {
   if (record.getType() == LegacyPropertyType.STRING) {
     List<LegacyDynamicRecord> stringRecords =
         stringPropertyStore.getPropertyChain(record.getPropBlock());
     for (LegacyDynamicRecord stringRecord : stringRecords) {
       stringRecord.setType(PropertyType.STRING.intValue());
     }
     return stringRecords;
   } else if (record.getType() == LegacyPropertyType.ARRAY) {
     List<LegacyDynamicRecord> arrayRecords =
         arrayPropertyStore.getPropertyChain(record.getPropBlock());
     for (LegacyDynamicRecord arrayRecord : arrayRecords) {
       arrayRecord.setType(PropertyType.ARRAY.intValue());
     }
     return arrayRecords;
   }
   return null;
 }
コード例 #3
0
 public void close() throws IOException {
   arrayPropertyStore.close();
   stringPropertyStore.close();
 }