protected BinaryIdContentPair generateIdContentPair(BinaryClassObject bco) { BinaryIdContentPair pair = new BinaryIdContentPair(idCount++, new BinaryOutputCapsule(this, bco)); return pair; } }
protected int findPrevMatch(BinaryIdContentPair oldPair, ArrayList<BinaryIdContentPair> bucket) { if (bucket == null) return -1; for (int x = bucket.size(); --x >= 0;) { BinaryIdContentPair pair = bucket.get(x); if (pair.getContent().equals(oldPair.getContent())) return locationTable.get(pair.getId()); } return -1; }
protected String getChunk(BinaryIdContentPair pair) { return new String(pair.getContent().bytes, 0, Math.min(64, pair .getContent().bytes.length)); }
public BinaryOutputCapsule getCapsule(Savable object) { return contentTable.get(object).getContent(); }
public int processBinarySavable(Savable object) throws IOException { if (object == null) { return -1; } Class<? extends Savable> clazz = object.getClass(); BinaryClassObject bco = classes.get(object.getClass().getName()); // is this class been looked at before? in tagTable? if (bco == null) { bco = createClassObject(object.getClass()); } // is object in contentTable? if (contentTable.get(object) != null) { return (contentTable.get(object).getId()); } BinaryIdContentPair newPair = generateIdContentPair(bco); BinaryIdContentPair old = contentTable.put(object, newPair); if (old == null) { contentKeys.add(object); } object.write(this); newPair.getContent().finish(); return newPair.getId(); }
protected String getChunk(BinaryIdContentPair pair) { return new String(pair.getContent().bytes, 0, Math.min(64, pair .getContent().bytes.length)); }
protected BinaryIdContentPair generateIdContentPair(BinaryClassObject bco) { BinaryIdContentPair pair = new BinaryIdContentPair(idCount++, new BinaryOutputCapsule(this, bco)); return pair; } }
int prevLoc = findPrevMatch(pair, bucket); if (prevLoc != -1) { locationTable.put(pair.getId(), prevLoc); continue; locationTable.put(pair.getId(), location); if (bucket == null) { bucket = new ArrayList<BinaryIdContentPair>(); out.write(aliasBytes); location += aliasSize; BinaryOutputCapsule cap = contentTable.get(savable).getContent(); out.write(ByteUtils.convertToBytes(cap.bytes.length)); location += 4; // length of bytes
public BinaryOutputCapsule getCapsule(Savable object) { return contentTable.get(object).getContent(); }
protected BinaryIdContentPair generateIdContentPair(BinaryClassObject bco) { BinaryIdContentPair pair = new BinaryIdContentPair(idCount++, new BinaryOutputCapsule(this, bco)); return pair; } }
protected int findPrevMatch(BinaryIdContentPair oldPair, ArrayList<BinaryIdContentPair> bucket) { if (bucket == null) return -1; for (int x = bucket.size(); --x >= 0;) { BinaryIdContentPair pair = bucket.get(x); if (pair.getContent().equals(oldPair.getContent())) return locationTable.get(pair.getId()); } return -1; }
protected String getChunk(BinaryIdContentPair pair) { return new String(pair.getContent().bytes, 0, Math.min(64, pair .getContent().bytes.length)); }
protected int findPrevMatch(BinaryIdContentPair oldPair, ArrayList<BinaryIdContentPair> bucket) { if (bucket == null) return -1; for (int x = bucket.size(); --x >= 0;) { BinaryIdContentPair pair = bucket.get(x); if (pair.getContent().equals(oldPair.getContent())) return locationTable.get(pair.getId()); } return -1; }
public BinaryOutputCapsule getCapsule(Savable object) { return contentTable.get(object).getContent(); }
public int processBinarySavable(Savable object) throws IOException { if (object == null) { return -1; } Class<? extends Savable> clazz = object.getClass(); BinaryClassObject bco = classes.get(object.getClass().getName()); // is this class been looked at before? in tagTable? if (bco == null) { bco = createClassObject(object.getClass()); } // is object in contentTable? if (contentTable.get(object) != null) { return (contentTable.get(object).getId()); } BinaryIdContentPair newPair = generateIdContentPair(bco); BinaryIdContentPair old = contentTable.put(object, newPair); if (old == null) { contentKeys.add(object); } object.write(this); newPair.getContent().finish(); return newPair.getId(); }
public int processBinarySavable(Savable object) throws IOException { if (object == null) { return -1; } Class<? extends Savable> clazz = object.getClass(); BinaryClassObject bco = classes.get(object.getClass().getName()); // is this class been looked at before? in tagTable? if (bco == null) { bco = createClassObject(object.getClass()); } // is object in contentTable? if (contentTable.get(object) != null) { return (contentTable.get(object).getId()); } BinaryIdContentPair newPair = generateIdContentPair(bco); BinaryIdContentPair old = contentTable.put(object, newPair); if (old == null) { contentKeys.add(object); } object.write(this); newPair.getContent().finish(); return newPair.getId(); }
int prevLoc = findPrevMatch(pair, bucket); if (prevLoc != -1) { locationTable.put(pair.getId(), prevLoc); continue; locationTable.put(pair.getId(), location); if (bucket == null) { bucket = new ArrayList<BinaryIdContentPair>(); out.write(aliasBytes); location += aliasSize; BinaryOutputCapsule cap = contentTable.get(savable).getContent(); out.write(ByteUtils.convertToBytes(cap.bytes.length)); location += 4; // length of bytes
int prevLoc = findPrevMatch(pair, bucket); if (prevLoc != -1) { locationTable.put(pair.getId(), prevLoc); continue; locationTable.put(pair.getId(), location); if (bucket == null) { bucket = new ArrayList<BinaryIdContentPair>(); out.write(aliasBytes); location += aliasSize; BinaryOutputCapsule cap = contentTable.get(savable).getContent(); out.write(ByteUtils.convertToBytes(cap.bytes.length)); location += 4; // length of bytes