@Test public void testSetBinaryValue() { MetadataDescriptor desc = new MetadataDescriptor("name", MetadataDescriptor.TYPE_BOOLEAN); desc.setBinaryValue(new byte[0]); Assert.assertEquals(MetadataDescriptor.TYPE_BINARY, desc.getType()); Assert.assertTrue(desc.isEmpty()); byte[] test = new byte[8192]; Random rand = new Random(System.currentTimeMillis()); rand.nextBytes(test); desc.setBinaryValue(test); Assert.assertTrue(Arrays.equals(test, desc.getRawData())); desc = new MetadataDescriptor(ContainerType.EXTENDED_CONTENT, "name", MetadataDescriptor.TYPE_BINARY); test = new byte[MetadataDescriptor.WORD_MAXVALUE + 1]; try { desc.setBinaryValue(test); Assert.fail("Exception expected"); } catch (IllegalArgumentException iae) { } }
public void setBinaryValue(final byte[] data) throws IllegalArgumentException { this.containerType.assertConstraints(this.name, data, this.descriptorType, this.streamNumber, this.languageIndex); this.content = data.clone(); this.descriptorType = TYPE_BINARY; }
MetadataDescriptor implements Comparable<MetadataDescriptor>, Cloneable { public void setBinaryValue(final byte[] data) throws IllegalArgumentException { this.containerType.assertConstraints(this.name, data, this.descriptorType, this.streamNumber, this.languageIndex); this.content = data.clone(); this.descriptorType = TYPE_BINARY; } }
MetadataDescriptor implements Comparable<MetadataDescriptor>, Cloneable { public void setBinaryValue(final byte[] data) throws IllegalArgumentException { this.containerType.assertConstraints(this.name, data, this.descriptorType, this.streamNumber, this.languageIndex); this.content = data.clone(); this.descriptorType = TYPE_BINARY; } MetadataDescriptor(final ContainerType type, final String propName, final int propType);  MetadataDescriptor(final ContainerType type,
                            final String propName,
                            final int propType,
                            final int stream,
                            final int language);  MetadataDescriptor(final String propName);  MetadataDescriptor(final String propName, final int propType); }
MetadataDescriptor implements Comparable<MetadataDescriptor>, Cloneable { public void setBinaryValue(final byte[] data) throws IllegalArgumentException { this.containerType.assertConstraints(this.name, data, this.descriptorType, this.streamNumber, this.languageIndex); this.content = data.clone(); this.descriptorType = TYPE_BINARY; } MetadataDescriptor(final ContainerType type, final String propName, final int propType);  MetadataDescriptor(final ContainerType type,
                            final String propName,
                            final int propType,
                            final int stream,
                            final int language);  MetadataDescriptor(final String propName);  MetadataDescriptor(final String propName, final int propType); @Override Object clone(); int compareTo(final MetadataDescriptor other); MetadataDescriptor createCopy(); @Override boolean equals(final Object obj); boolean getBoolean(); @Deprecated byte[] getBytes(); ContainerType getContainerType(); GUID getGuid(); String getName(); long getNumber(); byte[] getRawData(); int getRawDataSize(); String getString(); int getType(); @Override int hashCode(); boolean isEmpty(); void setBinaryValue(final byte[] data); void setBooleanValue(final boolean value); void setDWordValue(final long value); void setGUIDValue(final GUID value); void setQWordValue(final long value); void setString(final String value); void setStringValue(final String value); void setWordValue(final int value); @Override String toString(); }
MetadataDescriptor implements Comparable<MetadataDescriptor>, Cloneable { public void setBinaryValue(final byte[] data) throws IllegalArgumentException { this.containerType.assertConstraints(this.name, data, this.descriptorType, this.streamNumber, this.languageIndex); this.content = data.clone(); this.descriptorType = TYPE_BINARY; } MetadataDescriptor(final ContainerType type, final String propName, final int propType);  MetadataDescriptor(final ContainerType type,
                            final String propName,
                            final int propType,
                            final int stream,
                            final int language);  MetadataDescriptor(final String propName);  MetadataDescriptor(final String propName, final int propType); @Override Object clone(); int compareTo(final MetadataDescriptor other); MetadataDescriptor createCopy(); @Override boolean equals(final Object obj); boolean getBoolean(); @Deprecated byte[] getBytes(); ContainerType getContainerType(); GUID getGuid(); String getName(); long getNumber(); byte[] getRawData(); int getRawDataSize(); String getString(); int getType(); @Override int hashCode(); boolean isEmpty(); void setBinaryValue(final byte[] data); void setBooleanValue(final boolean value); void setDWordValue(final long value); void setGUIDValue(final GUID value); void setQWordValue(final long value); void setString(final String value); void setStringValue(final String value); void setWordValue(final int value); @Override String toString(); static final long DWORD_MAXVALUE; static final int MAX_LANG_INDEX; static final int MAX_STREAM_NUMBER; final static int TYPE_BINARY; final static int TYPE_BOOLEAN; final static int TYPE_DWORD; final static int TYPE_GUID; final static int TYPE_QWORD; final static int TYPE_STRING; final static int TYPE_WORD; }