/** * Convenience method returning the {@link Property} array contained in this * property set. It is a shortcut for getting he {@link PropertySet}'s * {@link Section}s list and then getting the {@link Property} array from the * first {@link Section}. * * @return The properties of the only {@link Section} of this * {@link PropertySet}. * @throws NoSingleSectionException if the {@link PropertySet} has * more or less than one {@link Section}. */ public Property[] getProperties() throws NoSingleSectionException { return getFirstSection().getProperties(); }
/** * Removes all properties from the section including 0 (dictionary) and 1 (codepage). */ public void clear() { for (Property p : getProperties()) { removeProperty(p.getID()); } }
public String toString(PropertyIDMap idMap) { final StringBuilder b = new StringBuilder(); final Property[] pa = getProperties(); b.append("\n\n\n"); b.append(getClass().getName()); b.append('['); b.append("formatID: "); b.append(getFormatID()); b.append(", offset: "); b.append(getOffset()); b.append(", propertyCount: "); b.append(getPropertyCount()); b.append(", size: "); b.append(getSize()); b.append(", properties: [\n"); int codepage = getCodepage(); if (codepage == -1) { codepage = Property.DEFAULT_CODEPAGE; } for (Property p : pa) { b.append(p.toString(codepage, idMap)); b.append(",\n"); } b.append(']'); b.append(']'); return b.toString(); }
/** * @see Object#hashCode() */ @Override public int hashCode() { long hashCode = 0; hashCode += getFormatID().hashCode(); final Property[] pa = getProperties(); for (Property aPa : pa) { hashCode += aPa.hashCode(); } return (int) (hashCode & 0x0ffffffffL); }
/** * Gets the custom properties. * * @return The custom properties. */ public CustomProperties getCustomProperties() { CustomProperties cps = null; if (getSectionCount() >= 2) { cps = new CustomProperties(); final Section section = getSections().get(1); final Map<Long,String> dictionary = section.getDictionary(); final Property[] properties = section.getProperties(); int propertyCount = 0; for (Property p : properties) { final long id = p.getID(); if (id == PropertyIDMap.PID_CODEPAGE) { cps.setCodepage((Integer)p.getValue()); } else if (id > PropertyIDMap.PID_CODEPAGE) { propertyCount++; final CustomProperty cp = new CustomProperty(p, dictionary.get(id)); cps.put(cp.getName(), cp); } } if (cps.size() != propertyCount) { cps.setPure(false); } } return cps; }
/** * Convenience method returning the {@link Property} array contained in this * property set. It is a shortcut for getting he {@link PropertySet}'s * {@link Section}s list and then getting the {@link Property} array from the * first {@link Section}. * * @return The properties of the only {@link Section} of this * {@link PropertySet}. * @throws NoSingleSectionException if the {@link PropertySet} has * more or less than one {@link Section}. */ public Property[] getProperties() throws NoSingleSectionException { return getFirstSection().getProperties(); }
/** * <p>Convenience method returning the {@link Property} array * contained in this property set. It is a shortcut for getting * the {@link PropertySet}'s {@link Section}s list and then * getting the {@link Property} array from the first {@link * Section}.</p> * * @return The properties of the only {@link Section} of this * {@link PropertySet}. * @throws NoSingleSectionException if the {@link PropertySet} has * more or less than one {@link Section}. */ public Property[] getProperties() throws NoSingleSectionException { return getFirstSection().getProperties(); }
/** * <p>Convenience method returning the {@link Property} array * contained in this property set. It is a shortcut for getting * the {@link PropertySet}'s {@link Section}s list and then * getting the {@link Property} array from the first {@link * Section}.</p> * * @return The properties of the only {@link Section} of this * {@link PropertySet}. * @throws NoSingleSectionException if the {@link PropertySet} has * more or less than one {@link Section}. */ public Property[] getProperties() throws NoSingleSectionException { return getFirstSection().getProperties(); }
/** * Removes all properties from the section including 0 (dictionary) and 1 (codepage). */ public void clear() { for (Property p : getProperties()) { removeProperty(p.getID()); } }
/** * @see Object#toString() */ public String toString() { final StringBuffer b = new StringBuffer(); final Property[] pa = getProperties(); b.append(getClass().getName()); b.append('['); b.append("formatID: "); b.append(getFormatID()); b.append(", offset: "); b.append(getOffset()); b.append(", propertyCount: "); b.append(getPropertyCount()); b.append(", size: "); b.append(getSize()); b.append(", properties: [\n"); for (int i = 0; i < pa.length; i++) { b.append(pa[i].toString()); b.append(",\n"); } b.append(']'); b.append(']'); return b.toString(); }
public String toString(PropertyIDMap idMap) { final StringBuilder b = new StringBuilder(); final Property[] pa = getProperties(); b.append("\n\n\n"); b.append(getClass().getName()); b.append('['); b.append("formatID: "); b.append(getFormatID()); b.append(", offset: "); b.append(getOffset()); b.append(", propertyCount: "); b.append(getPropertyCount()); b.append(", size: "); b.append(getSize()); b.append(", properties: [\n"); int codepage = getCodepage(); if (codepage == -1) { codepage = Property.DEFAULT_CODEPAGE; } for (Property p : pa) { b.append(p.toString(codepage, idMap)); b.append(",\n"); } b.append(']'); b.append(']'); return b.toString(); }
/** * @see Object#toString() */ public String toString() { final StringBuffer b = new StringBuffer(); final Property[] pa = getProperties(); b.append(getClass().getName()); b.append('['); b.append("formatID: "); b.append(getFormatID()); b.append(", offset: "); b.append(getOffset()); b.append(", propertyCount: "); b.append(getPropertyCount()); b.append(", size: "); b.append(getSize()); b.append(", properties: [\n"); for (int i = 0; i < pa.length; i++) { b.append(pa[i].toString()); b.append(",\n"); } b.append(']'); b.append(']'); return b.toString(); }
/** * @see Object#hashCode() */ @Override public int hashCode() { long hashCode = 0; hashCode += getFormatID().hashCode(); final Property[] pa = getProperties(); for (Property aPa : pa) { hashCode += aPa.hashCode(); } return (int) (hashCode & 0x0ffffffffL); }
/** * @see Object#hashCode() */ public int hashCode() { long hashCode = 0; hashCode += getFormatID().hashCode(); final Property[] pa = getProperties(); for (int i = 0; i < pa.length; i++) hashCode += pa[i].hashCode(); final int returnHashCode = (int) (hashCode & 0x0ffffffffL); return returnHashCode; }
/** * @see Object#hashCode() */ public int hashCode() { long hashCode = 0; hashCode += getFormatID().hashCode(); final Property[] pa = getProperties(); for (int i = 0; i < pa.length; i++) hashCode += pa[i].hashCode(); final int returnHashCode = (int) (hashCode & 0x0ffffffffL); return returnHashCode; }
final Section section = (Section) getSections().get(1); final Map<Long,String> dictionary = section.getDictionary(); final Property[] properties = section.getProperties(); int propertyCount = 0; for (int i = 0; i < properties.length; i++)
/** * <p>Constructs a <code>MutableSection</code> by doing a deep copy of an * existing <code>Section</code>. All nested <code>Property</code> * instances, will be their mutable counterparts in the new * <code>MutableSection</code>.</p> * * @param s The section set to copy */ public MutableSection(final Section s) { setFormatID(s.getFormatID()); final Property[] pa = s.getProperties(); final MutableProperty[] mpa = new MutableProperty[pa.length]; for (int i = 0; i < pa.length; i++) mpa[i] = new MutableProperty(pa[i]); setProperties(mpa); setDictionary(s.getDictionary()); }
/** * <p>Constructs a <code>MutableSection</code> by doing a deep copy of an * existing <code>Section</code>. All nested <code>Property</code> * instances, will be their mutable counterparts in the new * <code>MutableSection</code>.</p> * * @param s The section set to copy */ public MutableSection(final Section s) { setFormatID(s.getFormatID()); final Property[] pa = s.getProperties(); final MutableProperty[] mpa = new MutableProperty[pa.length]; for (int i = 0; i < pa.length; i++) mpa[i] = new MutableProperty(pa[i]); setProperties(mpa); setDictionary(s.getDictionary()); }
final Section section = (Section) getSections().get(1); final Map<Long,String> dictionary = section.getDictionary(); final Property[] properties = section.getProperties(); int propertyCount = 0; for (int i = 0; i < properties.length; i++)
/** * Gets the custom properties. * * @return The custom properties. */ public CustomProperties getCustomProperties() { CustomProperties cps = null; if (getSectionCount() >= 2) { cps = new CustomProperties(); final Section section = getSections().get(1); final Map<Long,String> dictionary = section.getDictionary(); final Property[] properties = section.getProperties(); int propertyCount = 0; for (Property p : properties) { final long id = p.getID(); if (id == PropertyIDMap.PID_CODEPAGE) { cps.setCodepage((Integer)p.getValue()); } else if (id > PropertyIDMap.PID_CODEPAGE) { propertyCount++; final CustomProperty cp = new CustomProperty(p, dictionary.get(id)); cps.put(cp.getName(), cp); } } if (cps.size() != propertyCount) { cps.setPure(false); } } return cps; }