public ClassID getClassID() { synchronized (this) { // TODO: init classId directly in the constructor when old statics have been removed from ClassID if (classId == null) { classId = new ClassID(externalForm); } } return classId; }
@Override public boolean canExtract(DirectoryNode dn) { ClassID clsId = dn.getStorageClsid(); return (PdfClassID.equals(clsId) || dn.hasEntry("CONTENTS")); }
/** * @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); }
/* package */ static boolean matchesSummary(ClassID actual, ClassID... expected) { for (ClassID sum : expected) { if (sum.equals(actual) || sum.equalsInverted(actual)) { return true; } } return false; }
/** * Sets the section's format ID. * * @param formatID The section's format ID as a byte array. It components * are in big-endian format. */ @SuppressWarnings("WeakerAccess") public void setFormatID(final byte[] formatID) { ClassID fid = getFormatID(); if (fid == null) { fid = new ClassID(); setFormatID(fid); } fid.setBytes(formatID); }
/** * <p>Converts a class ID into its hexadecimal notation.</p> */ public static String hexEncode(final ClassID classID) { return hexEncode(classID.getBytes()); }
/** * @see Object#hashCode() */ @Override public int hashCode() { return toString().hashCode(); }
private static void putClassId(final ByteArrayOutputStream out, final ClassID n) { byte[] b = new byte[16]; n.write(b, 0); out.write(b, 0, b.length); } }
/** * Creates a {@link ClassID} and reads its value from a byte array. * * @param src The byte array to read from. * @param offset The offset of the first byte to read. */ public ClassID(final byte[] src, final int offset) { read(src, offset); }
/** * Sets the section's format ID. * * @param formatID The section's format ID as a byte array. It components * are in big-endian format. */ @SuppressWarnings("WeakerAccess") public void setFormatID(final byte[] formatID) { ClassID fid = getFormatID(); if (fid == null) { fid = new ClassID(); setFormatID(fid); } fid.setBytes(formatID); }
/** * <p>Converts a class ID into its hexadecimal notation.</p> */ public static String hexEncode(final ClassID classID) { return hexEncode(classID.getBytes()); }
public static ClassIDPredefined lookup(final ClassID classID) { return (classID == null) ? null : LOOKUP.get(classID.toString()); } }
/** * Sets the storage class ID for this property stream. This is the Class ID * of the COM object which can read and write this property stream * @param clsidStorage Storage Class ID */ public void setStorageClsid( ClassID clsidStorage) { _storage_clsid = clsidStorage; if( clsidStorage == null) { Arrays.fill( _raw_data, _storage_clsid_offset, _storage_clsid_offset + ClassID.LENGTH, (byte) 0); } else { clsidStorage.write( _raw_data, _storage_clsid_offset); } } /**
/* package */ static boolean matchesSummary(ClassID actual, ClassID... expected) { for (ClassID sum : expected) { if (sum.equals(actual) || sum.equalsInverted(actual)) { return true; } } return false; }
/** * <p>Creates a {@link ClassID} and reads its value from a byte * array.</p> * * @param src The byte array to read from. * @param offset The offset of the first byte to read. */ public ClassID(final byte[] src, final int offset) { read(src, offset); }
/** * Constructs a {@code PropertySet} instance. Its * primary task is to initialize the field with their proper values. * It also sets fields that might change to reasonable defaults. */ public PropertySet() { /* Initialize the "byteOrder" field. */ byteOrder = BYTE_ORDER_ASSERTION; /* Initialize the "format" field. */ format = FORMAT_ASSERTION; /* Initialize "osVersion" field as if the property has been created on * a Win32 platform, whether this is the case or not. */ osVersion = (OS_WIN32 << 16) | 0x0A04; /* Initialize the "classID" field. */ classID = new ClassID(); /* Initialize the sections. Since property set must have at least * one section it is added right here. */ addSection(new Section()); }
/** * <p>Sets the section's format ID.</p> * * @param formatID The section's format ID as a byte array. It components * are in big-endian format. * * @see #setFormatID(ClassID) * @see Section#getFormatID */ public void setFormatID(final byte[] formatID) { ClassID fid = getFormatID(); if (fid == null) { fid = new ClassID(); setFormatID(fid); } fid.setBytes(formatID); }