/** {@inheritDoc} */ @Override public int writeSize() { throwIfNotPrepared(); return writeSize; }
/** {@inheritDoc} */ @Override public int writeSize() { throwIfNotPrepared(); return writeSize; }
/** {@inheritDoc} */ @Override public int writeSize() { throwIfNotPrepared(); return writeSize; }
/** {@inheritDoc} */ @Override public int writeSize() { throwIfNotPrepared(); return writeSize; }
/** {@inheritDoc} */ @Override public int writeSize() { throwIfNotPrepared(); return writeSize; }
/** {@inheritDoc} */ @Override public int writeSize() { throwIfNotPrepared(); return writeSize; }
/** {@inheritDoc} */ @Override public int writeSize() { throwIfNotPrepared(); return writeSize; }
/** {@inheritDoc} */ @Override public int writeSize() { throwIfNotPrepared(); return writeSize; }
/** * Gets an item which was previously interned. * * @param item {@code non-null;} the item to look for * @return {@code non-null;} the equivalent already-interned instance */ public <T extends OffsettedItem> T get(T item) { throwIfNotPrepared(); OffsettedItem result = interns.get(item); if (result != null) { return (T) result; } throw new NoSuchElementException(item.toString()); }
/** * Gets an item which was previously interned. * * @param item {@code non-null;} the item to look for * @return {@code non-null;} the equivalent already-interned instance */ public <T extends OffsettedItem> T get(T item) { throwIfNotPrepared(); OffsettedItem result = interns.get(item); if (result != null) { return (T) result; } throw new NoSuchElementException(item.toString()); }
/** * Gets an item which was previously interned. * * @param item {@code non-null;} the item to look for * @return {@code non-null;} the equivalent already-interned instance */ public <T extends OffsettedItem> T get(T item) { throwIfNotPrepared(); OffsettedItem result = interns.get(item); if (result != null) { return (T) result; } throw new NoSuchElementException(item.toString()); }
/** * Gets an item which was previously interned. * * @param item {@code non-null;} the item to look for * @return {@code non-null;} the equivalent already-interned instance */ public <T extends OffsettedItem> T get(T item) { throwIfNotPrepared(); OffsettedItem result = interns.get(item); if (result != null) { return (T) result; } throw new NoSuchElementException(item.toString()); }
/** * Gets an item which was previously interned. * * @param item {@code non-null;} the item to look for * @return {@code non-null;} the equivalent already-interned instance */ public <T extends OffsettedItem> T get(T item) { throwIfNotPrepared(); OffsettedItem result = interns.get(item); if (result != null) { return (T) result; } throw new NoSuchElementException(item.toString()); }
/** * Gets an item which was previously interned. * * @param item {@code non-null;} the item to look for * @return {@code non-null;} the equivalent already-interned instance */ public <T extends OffsettedItem> T get(T item) { throwIfNotPrepared(); OffsettedItem result = interns.get(item); if (result != null) { return (T) result; } throw new NoSuchElementException(item.toString()); }
/** * Gets an item which was previously interned. * * @param item {@code non-null;} the item to look for * @return {@code non-null;} the equivalent already-interned instance */ public <T extends OffsettedItem> T get(T item) { throwIfNotPrepared(); OffsettedItem result = interns.get(item); if (result != null) { return (T) result; } throw new NoSuchElementException(item.toString()); }
/** * Writes an index of contents of the items in this instance of the * given type. If there are none, this writes nothing. If there are any, * then the index is preceded by the given intro string. * * @param out {@code non-null;} where to write to * @param itemType {@code non-null;} the item type of interest * @param intro {@code non-null;} the introductory string for non-empty indices */ public void writeIndexAnnotation(AnnotatedOutput out, ItemType itemType, String intro) { throwIfNotPrepared(); TreeMap<String, OffsettedItem> index = new TreeMap<String, OffsettedItem>(); for (OffsettedItem item : items) { if (item.itemType() == itemType) { String label = item.toHuman(); index.put(label, item); } } if (index.size() == 0) { return; } out.annotate(0, intro); for (Map.Entry<String, OffsettedItem> entry : index.entrySet()) { String label = entry.getKey(); OffsettedItem item = entry.getValue(); out.annotate(0, item.offsetString() + ' ' + label + '\n'); } }
/** * Writes the portion of the file header that refers to this instance. * * @param out {@code non-null;} where to write */ public void writeHeaderPart(AnnotatedOutput out) { throwIfNotPrepared(); if (writeSize == -1) { throw new RuntimeException("write size not yet set"); } int sz = writeSize; int offset = (sz == 0) ? 0 : getFileOffset(); String name = getName(); if (name == null) { name = "<unnamed>"; } int spaceCount = 15 - name.length(); char[] spaceArr = new char[spaceCount]; Arrays.fill(spaceArr, ' '); String spaces = new String(spaceArr); if (out.annotates()) { out.annotate(4, name + "_size:" + spaces + Hex.u4(sz)); out.annotate(4, name + "_off: " + spaces + Hex.u4(offset)); } out.writeInt(sz); out.writeInt(offset); }
/** * Writes the portion of the file header that refers to this instance. * * @param out {@code non-null;} where to write */ public void writeHeaderPart(AnnotatedOutput out) { throwIfNotPrepared(); if (writeSize == -1) { throw new RuntimeException("write size not yet set"); } int sz = writeSize; int offset = (sz == 0) ? 0 : getFileOffset(); String name = getName(); if (name == null) { name = "<unnamed>"; } int spaceCount = 15 - name.length(); char[] spaceArr = new char[spaceCount]; Arrays.fill(spaceArr, ' '); String spaces = new String(spaceArr); if (out.annotates()) { out.annotate(4, name + "_size:" + spaces + Hex.u4(sz)); out.annotate(4, name + "_off: " + spaces + Hex.u4(offset)); } out.writeInt(sz); out.writeInt(offset); }
/** * Writes the portion of the file header that refers to this instance. * * @param out {@code non-null;} where to write */ public void writeHeaderPart(AnnotatedOutput out) { throwIfNotPrepared(); if (writeSize == -1) { throw new RuntimeException("write size not yet set"); } int sz = writeSize; int offset = (sz == 0) ? 0 : getFileOffset(); String name = getName(); if (name == null) { name = "<unnamed>"; } int spaceCount = 15 - name.length(); char[] spaceArr = new char[spaceCount]; Arrays.fill(spaceArr, ' '); String spaces = new String(spaceArr); if (out.annotates()) { out.annotate(4, name + "_size:" + spaces + Hex.u4(sz)); out.annotate(4, name + "_off: " + spaces + Hex.u4(offset)); } out.writeInt(sz); out.writeInt(offset); }
/** * Writes the portion of the file header that refers to this instance. * * @param out {@code non-null;} where to write */ public void writeHeaderPart(AnnotatedOutput out) { throwIfNotPrepared(); if (writeSize == -1) { throw new RuntimeException("write size not yet set"); } int sz = writeSize; int offset = (sz == 0) ? 0 : getFileOffset(); String name = getName(); if (name == null) { name = "<unnamed>"; } int spaceCount = 15 - name.length(); char[] spaceArr = new char[spaceCount]; Arrays.fill(spaceArr, ' '); String spaces = new String(spaceArr); if (out.annotates()) { out.annotate(4, name + "_size:" + spaces + Hex.u4(sz)); out.annotate(4, name + "_off: " + spaces + Hex.u4(offset)); } out.writeInt(sz); out.writeInt(offset); }