code
stringlengths
11
173k
docstring
stringlengths
2
593k
func_name
stringlengths
2
189
language
stringclasses
1 value
repo
stringclasses
844 values
path
stringlengths
11
294
url
stringlengths
60
339
license
stringclasses
4 values
public MetadataContainer(final ContainerType type, final long pos, final BigInteger size) { super(type.getContainerGUID(), pos, size); this.containerType = type; }
Creates an instance. @param type determines the type of the container @param pos location in the ASF file @param size size of the chunk.
DescriptorPointer::MetadataContainer
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
public MetadataContainer(final GUID containerGUID, final long pos, final BigInteger size) { this(determineType(containerGUID), pos, size); }
Creates an instance. @param containerGUID the containers GUID @param pos location in the ASF file @param size size of the chunk.
DescriptorPointer::MetadataContainer
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
public final void addDescriptor(final MetadataDescriptor toAdd) throws IllegalArgumentException { // check with throwing exceptions this.containerType.assertConstraints(toAdd.getName(), toAdd.getRawData(), toAdd.getType(), toAdd.getStreamNumber(), toAdd.getLanguageIndex()); // validate containers capabilities if (!isAddSupported(toAdd)) { throw new IllegalArgumentException("Descriptor cannot be added, see isAddSupported(...)"); } /* * Check for containers types capabilities. */ // Search for descriptor list by name, language and stream. List<MetadataDescriptor> list; synchronized (this.perfPoint) { list = this.descriptors.get(this.perfPoint.setDescriptor(toAdd)); } if (list == null) { list = new ArrayList<MetadataDescriptor>(); this.descriptors.put(new DescriptorPointer(toAdd), list); } else { if (!list.isEmpty() && !this.containerType.isMultiValued()) { throw new IllegalArgumentException("Container does not allow multiple values of descriptors with same name, language index and stream number"); } } list.add(toAdd); }
Adds a metadata descriptor. @param toAdd the descriptor to add. @throws IllegalArgumentException if descriptor does not meet container requirements, or already exist.
DescriptorPointer::addDescriptor
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
protected final MetadataDescriptor assertDescriptor(final String key) { return assertDescriptor(key, MetadataDescriptor.TYPE_STRING); }
This method asserts that this container has a descriptor with the specified key, means returns an existing or creates a new descriptor. @param key the descriptor name to look up (or create) @return the/a descriptor with the specified name (and initial type of {@link MetadataDescriptor#TYPE_STRING}.
DescriptorPointer::assertDescriptor
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
protected final MetadataDescriptor assertDescriptor(final String key, final int type) { MetadataDescriptor desc; final List<MetadataDescriptor> descriptorsByName = getDescriptorsByName(key); if (descriptorsByName == null || descriptorsByName.isEmpty()) { desc = new MetadataDescriptor(getContainerType(), key, type); addDescriptor(desc); } else { desc = descriptorsByName.get(0); } return desc; }
This method asserts that this container has a descriptor with the specified key, means returns an existing or creates a new descriptor. @param key the descriptor name to look up (or create) @param type if the descriptor is created, this data type is applied. @return the/a descriptor with the specified name.
DescriptorPointer::assertDescriptor
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
public final boolean containsDescriptor(final MetadataDescriptor lookup) { assert lookup != null; return this.descriptors.containsKey(this.perfPoint.setDescriptor(lookup)); }
Checks whether a descriptor already exists.<br> Name, stream number and language index are compared. Data and data type are ignored. @param lookup descriptor to look up. @return <code>true</code> if such a descriptor already exists.
DescriptorPointer::containsDescriptor
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
public final ContainerType getContainerType() { return this.containerType; }
Returns the type of container this instance represents.<br> @return represented container type.
DescriptorPointer::getContainerType
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
public long getCurrentAsfChunkSize() { /* * 16 bytes GUID, 8 bytes chunk size, 2 bytes descriptor count */ long result = 26; for (final MetadataDescriptor curr : getDescriptors()) { result += curr.getCurrentAsfSize(this.containerType); } return result; }
{@inheritDoc}
DescriptorPointer::getCurrentAsfChunkSize
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
public final int getDescriptorCount() { return this.getDescriptors().size(); }
Returns the number of contained descriptors. @return number of descriptors.
DescriptorPointer::getDescriptorCount
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
public final List<MetadataDescriptor> getDescriptors() { final List<MetadataDescriptor> result = new ArrayList<MetadataDescriptor>(); for (final List<MetadataDescriptor> curr : this.descriptors.values()) { result.addAll(curr); } return result; }
Returns all stored descriptors. @return stored descriptors.
DescriptorPointer::getDescriptors
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
public final List<MetadataDescriptor> getDescriptorsByName(final String name) { assert name != null; final List<MetadataDescriptor> result = new ArrayList<MetadataDescriptor>(); final Collection<List<MetadataDescriptor>> values = this.descriptors.values(); for (final List<MetadataDescriptor> currList : values) { if (!currList.isEmpty() && currList.get(0).getName().equals(name)) { result.addAll(currList); } } return result; }
Returns a list of descriptors with the given {@linkplain MetadataDescriptor#getName() name}.<br> @param name name of the descriptors to return @return list of descriptors with given name.
DescriptorPointer::getDescriptorsByName
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
protected final String getValueFor(final String name) { String result = ""; final List<MetadataDescriptor> descs = getDescriptorsByName(name); if (descs != null) { assert descs.size() <= 1; if (!descs.isEmpty()) { result = descs.get(0).getString(); } } return result; }
This method looks up a descriptor with given name and returns its value as string.<br> @param name the name of the descriptor to look up. @return the string representation of a found descriptors value. Even an empty string if no descriptor has been found.
DescriptorPointer::getValueFor
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
public final boolean hasDescriptor(final String name) { return !getDescriptorsByName(name).isEmpty(); }
Determines if this container contains a descriptor with given {@linkplain MetadataDescriptor#getName() name}.<br> @param name Name of the descriptor to look for. @return <code>true</code> if descriptor has been found.
DescriptorPointer::hasDescriptor
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
public boolean isAddSupported(final MetadataDescriptor descriptor) { boolean result = getContainerType().checkConstraints(descriptor.getName(), descriptor.getRawData(), descriptor.getType(), descriptor.getStreamNumber(), descriptor.getLanguageIndex()) == null; // Now check if there is already a value contained. if (result && !getContainerType().isMultiValued()) { synchronized (this.perfPoint) { final List<MetadataDescriptor> list = this.descriptors.get(this.perfPoint.setDescriptor(descriptor)); if (list != null) { result = list.isEmpty(); } } } return result; }
Determines/checks if the given descriptor may be added to the container.<br> This implies a check for the capabilities of the container specified by its {@linkplain #getContainerType() container type}.<br> @param descriptor the descriptor to test. @return <code>true</code> if {@link #addDescriptor(MetadataDescriptor)} can be called with given descriptor.
DescriptorPointer::isAddSupported
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
public final boolean isEmpty() { boolean result = true; if (getDescriptorCount() != 0) { final Iterator<MetadataDescriptor> iterator = getDescriptors().iterator(); while (result && iterator.hasNext()) { result &= iterator.next().isEmpty(); } } return result; }
{@inheritDoc}
DescriptorPointer::isEmpty
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
public final void removeDescriptorsByName(final String name) { assert name != null; final Iterator<List<MetadataDescriptor>> iterator = this.descriptors.values().iterator(); while (iterator.hasNext()) { final List<MetadataDescriptor> curr = iterator.next(); if (!curr.isEmpty() && curr.get(0).getName().equals(name)) { iterator.remove(); } } }
Removes all stored descriptors with the given {@linkplain MetadataDescriptor#getName() name}.<br> @param name the name to remove.
DescriptorPointer::removeDescriptorsByName
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
protected final void setStringValue(final String name, final String value) { assertDescriptor(name).setStringValue(value); }
{@linkplain #assertDescriptor(String) asserts} the existence of a descriptor with given <code>name</code> and {@linkplain MetadataDescriptor#setStringValue(String) assings} the string value. @param name the name of the descriptor to set the value for. @param value the string value.
DescriptorPointer::setStringValue
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
public long writeInto(final OutputStream out) throws IOException { final long chunkSize = getCurrentAsfChunkSize(); final List<MetadataDescriptor> descriptorList = getDescriptors(); out.write(getGuid().getBytes()); Utils.writeUINT64(chunkSize, out); Utils.writeUINT16(descriptorList.size(), out); for (final MetadataDescriptor curr : descriptorList) { curr.writeInto(out, this.containerType); } return chunkSize; }
{@inheritDoc}
DescriptorPointer::writeInto
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainer.java
Apache-2.0
public AsfHeader(final long pos, final BigInteger chunkLen, final long chunkCnt) { super(GUID.GUID_HEADER, pos, chunkLen); this.chunkCount = chunkCnt; }
Creates an instance. @param pos see {@link Chunk#position} @param chunkLen see {@link Chunk#chunkLength} @param chunkCnt
AsfHeader::AsfHeader
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/AsfHeader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/AsfHeader.java
Apache-2.0
public ContentDescription findContentDescription() { ContentDescription result = getContentDescription(); if (result == null && getExtendedHeader() != null) { result = getExtendedHeader().getContentDescription(); } return result; }
This method looks for an content description object in this header instance, if not found there, it tries to get one from a contained ASF header extension object. @return content description if found, <code>null</code> otherwise.
AsfHeader::findContentDescription
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/AsfHeader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/AsfHeader.java
Apache-2.0
public MetadataContainer findExtendedContentDescription() { MetadataContainer result = getExtendedContentDescription(); if (result == null && getExtendedHeader() != null) { result = getExtendedHeader().getExtendedContentDescription(); } return result; }
This method looks for an extended content description object in this header instance, if not found there, it tries to get one from a contained ASF header extension object. @return extended content description if found, <code>null</code> otherwise.
AsfHeader::findExtendedContentDescription
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/AsfHeader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/AsfHeader.java
Apache-2.0
public EncryptionChunk(final BigInteger chunkLen) { super(GUID.GUID_CONTENT_ENCRYPTION, chunkLen); this.strings = new ArrayList<String>(); this.secretData = ""; this.protectionType = ""; this.keyID = ""; this.licenseURL = ""; }
Creates an instance. @param chunkLen Length of current chunk.
EncryptionChunk::EncryptionChunk
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
Apache-2.0
public void addString(final String toAdd) { this.strings.add(toAdd); }
This method appends a String. @param toAdd String to add.
EncryptionChunk::addString
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
Apache-2.0
public String getKeyID() { return this.keyID; }
This method gets the keyID. @return
EncryptionChunk::getKeyID
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
Apache-2.0
public String getLicenseURL() { return this.licenseURL; }
This method gets the license URL. @return
EncryptionChunk::getLicenseURL
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
Apache-2.0
public String getProtectionType() { return this.protectionType; }
This method gets the secret data. @return
EncryptionChunk::getProtectionType
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
Apache-2.0
public String getSecretData() { return this.secretData; }
This method gets the secret data. @return
EncryptionChunk::getSecretData
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
Apache-2.0
public Collection<String> getStrings() { return new ArrayList<String>(this.strings); }
This method returns a collection of all {@link String}s which were addid due {@link #addString(String)}. @return Inserted Strings.
EncryptionChunk::getStrings
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
Apache-2.0
public void setKeyID(final String toAdd) { this.keyID = toAdd; }
This method appends a String. @param toAdd String to add.
EncryptionChunk::setKeyID
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
Apache-2.0
public void setLicenseURL(final String toAdd) { this.licenseURL = toAdd; }
This method appends a String. @param toAdd String to add.
EncryptionChunk::setLicenseURL
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
Apache-2.0
public void setProtectionType(final String toAdd) { this.protectionType = toAdd; }
This method appends a String. @param toAdd String to add.
EncryptionChunk::setProtectionType
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
Apache-2.0
public void setSecretData(final String toAdd) { this.secretData = toAdd; }
This method adds the secret data. @param toAdd String to add.
EncryptionChunk::setSecretData
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/EncryptionChunk.java
Apache-2.0
public StreamChunk(final GUID streamType, final BigInteger chunkLen) { super(GUID.GUID_STREAM, chunkLen); assert GUID.GUID_AUDIOSTREAM.equals(streamType) || GUID.GUID_VIDEOSTREAM.equals(streamType); this.type = streamType; }
Creates an instance @param streamType The GUID which tells the stream type represented ( {@link GUID#GUID_AUDIOSTREAM} or {@link GUID#GUID_VIDEOSTREAM} ): @param chunkLen length of chunk
StreamChunk::StreamChunk
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
Apache-2.0
public int getStreamNumber() { return this.streamNumber; }
@return Returns the streamNumber.
StreamChunk::getStreamNumber
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
Apache-2.0
public long getStreamSpecificDataSize() { return this.streamSpecificDataSize; }
@return Returns the streamSpecificDataSize.
StreamChunk::getStreamSpecificDataSize
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
Apache-2.0
public GUID getStreamType() { return this.type; }
Returns the stream type of the stream chunk.<br> @return {@link GUID#GUID_AUDIOSTREAM} or {@link GUID#GUID_VIDEOSTREAM}.
StreamChunk::getStreamType
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
Apache-2.0
public long getTimeOffset() { return this.timeOffset; }
@return Returns the timeOffset.
StreamChunk::getTimeOffset
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
Apache-2.0
public long getTypeSpecificDataSize() { return this.typeSpecificDataSize; }
@return Returns the typeSpecificDataSize.
StreamChunk::getTypeSpecificDataSize
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
Apache-2.0
public boolean isContentEncrypted() { return this.contentEncrypted; }
@return Returns the contentEncrypted.
StreamChunk::isContentEncrypted
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
Apache-2.0
public void setContentEncrypted(final boolean cntEnc) { this.contentEncrypted = cntEnc; }
@param cntEnc The contentEncrypted to set.
StreamChunk::setContentEncrypted
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
Apache-2.0
public void setStreamNumber(final int streamNum) { this.streamNumber = streamNum; }
@param streamNum The streamNumber to set.
StreamChunk::setStreamNumber
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
Apache-2.0
public void setStreamSpecificDataSize(final long strSpecDataSize) { this.streamSpecificDataSize = strSpecDataSize; }
@param strSpecDataSize The streamSpecificDataSize to set.
StreamChunk::setStreamSpecificDataSize
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
Apache-2.0
public void setTimeOffset(final long timeOffs) { this.timeOffset = timeOffs; }
@param timeOffs sets the time offset
StreamChunk::setTimeOffset
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
Apache-2.0
public void setTypeSpecificDataSize(final long typeSpecDataSize) { this.typeSpecificDataSize = typeSpecDataSize; }
@param typeSpecDataSize The typeSpecificDataSize to set.
StreamChunk::setTypeSpecificDataSize
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/StreamChunk.java
Apache-2.0
public EncodingChunk(final BigInteger chunkLen) { super(GUID.GUID_ENCODING, chunkLen); this.strings = new ArrayList<String>(); }
Creates an instance. @param chunkLen Length of current chunk.
EncodingChunk::EncodingChunk
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/EncodingChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/EncodingChunk.java
Apache-2.0
public void addString(final String toAdd) { this.strings.add(toAdd); }
This method appends a String. @param toAdd String to add.
EncodingChunk::addString
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/EncodingChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/EncodingChunk.java
Apache-2.0
public Collection<String> getStrings() { return new ArrayList<String>(this.strings); }
This method returns a collection of all {@linkplain String Strings} which were added due {@link #addString(String)}. @return Inserted Strings.
EncodingChunk::getStrings
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/EncodingChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/EncodingChunk.java
Apache-2.0
public StreamBitratePropertiesChunk(final BigInteger chunkLen) { super(GUID.GUID_STREAM_BITRATE_PROPERTIES, chunkLen); this.bitRates = new ArrayList<Long>(); this.streamNumbers = new ArrayList<Integer>(); }
Creates an instance. @param chunkLen Length of current chunk.
StreamBitratePropertiesChunk::StreamBitratePropertiesChunk
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/StreamBitratePropertiesChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/StreamBitratePropertiesChunk.java
Apache-2.0
public void addBitrateRecord(final int streamNum, final long averageBitrate) { this.streamNumbers.add(streamNum); this.bitRates.add(averageBitrate); }
Adds the public values of a stream-record. @param streamNum The number of the referred stream. @param averageBitrate Its average bitrate.
StreamBitratePropertiesChunk::addBitrateRecord
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/StreamBitratePropertiesChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/StreamBitratePropertiesChunk.java
Apache-2.0
public long getAvgBitrate(final int streamNumber) { final Integer seach = streamNumber; final int index = this.streamNumbers.indexOf(seach); long result; if (index == -1) { result = -1; } else { result = this.bitRates.get(index); } return result; }
Returns the average bitrate of the given stream.<br> @param streamNumber Number of the stream whose bitrate to determine. @return The average bitrate of the numbered stream. <code>-1</code> if no information was given.
StreamBitratePropertiesChunk::getAvgBitrate
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/StreamBitratePropertiesChunk.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/StreamBitratePropertiesChunk.java
Apache-2.0
public ContentBranding() { this(0, BigInteger.ZERO); }
Creates an instance.
ContentBranding::ContentBranding
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
Apache-2.0
public ContentBranding(final long pos, final BigInteger size) { super(ContainerType.CONTENT_BRANDING, pos, size); }
Creates an instance. @param pos Position of content description within file or stream @param size Length of content description.
ContentBranding::ContentBranding
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
Apache-2.0
public String getBannerImageURL() { return getValueFor(KEY_BANNER_URL); }
Returns the banner image URL. @return the banner image URL.
ContentBranding::getBannerImageURL
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
Apache-2.0
public String getCopyRightURL() { return getValueFor(KEY_COPYRIGHT_URL); }
Returns the copyright URL. @return the banner image URL.
ContentBranding::getCopyRightURL
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
Apache-2.0
public byte[] getImageData() { return assertDescriptor(KEY_BANNER_IMAGE, MetadataDescriptor.TYPE_BINARY).getRawData(); }
Returns the binary image data. @return binary image data.
ContentBranding::getImageData
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
Apache-2.0
public long getImageType() { if (!hasDescriptor(KEY_BANNER_TYPE)) { final MetadataDescriptor descriptor = new MetadataDescriptor(ContainerType.CONTENT_BRANDING, KEY_BANNER_TYPE, MetadataDescriptor.TYPE_DWORD); descriptor.setDWordValue(0); addDescriptor(descriptor); } return assertDescriptor(KEY_BANNER_TYPE).getNumber(); }
Returns the image type.<br> @return image type @see #KEY_BANNER_TYPE for known/valid values.
ContentBranding::getImageType
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
Apache-2.0
public void setBannerImageURL(final String imageURL) { if (Utils.isBlank(imageURL)) { removeDescriptorsByName(KEY_BANNER_URL); } else { assertDescriptor(KEY_BANNER_URL).setStringValue(imageURL); } }
This method sets the banner image URL, if <code>imageURL</code> is not blank.<br> @param imageURL image URL to set.
ContentBranding::setBannerImageURL
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
Apache-2.0
public void setCopyRightURL(final String copyRight) { if (Utils.isBlank(copyRight)) { removeDescriptorsByName(KEY_COPYRIGHT_URL); } else { assertDescriptor(KEY_COPYRIGHT_URL).setStringValue(copyRight); } }
This method sets the copyright URL, if <code>copyRight</code> is not blank.<br> @param copyRight copyright URL to set.
ContentBranding::setCopyRightURL
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
Apache-2.0
public void setImage(final long imageType, final byte[] imageData) { assert imageType >= 0 && imageType <= 3; assert imageType > 0 || imageData.length == 0; assertDescriptor(KEY_BANNER_TYPE, MetadataDescriptor.TYPE_DWORD).setDWordValue(imageType); assertDescriptor(KEY_BANNER_IMAGE, MetadataDescriptor.TYPE_BINARY).setBinaryValue(imageData); }
@param imageType @param imageData
ContentBranding::setImage
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentBranding.java
Apache-2.0
public LanguageList() { super(GUID.GUID_LANGUAGE_LIST, 0, BigInteger.ZERO); }
Creates a new instance.<br>
LanguageList::LanguageList
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/LanguageList.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/LanguageList.java
Apache-2.0
public LanguageList(final long pos, final BigInteger size) { super(GUID.GUID_LANGUAGE_LIST, pos, size); }
Creates an instance. @param pos position within the ASF file. @param size size of the chunk
LanguageList::LanguageList
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/LanguageList.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/LanguageList.java
Apache-2.0
public void addLanguage(final String language) { if (language.length() < MetadataDescriptor.MAX_LANG_INDEX) { if (!this.languages.contains(language)) { this.languages.add(language); } } else { throw new IllegalArgumentException(ErrorMessage.WMA_LENGTH_OF_LANGUAGE_IS_TOO_LARGE.getMsg(language.length() * 2 + 2)); } }
This method adds a language.<br> @param language language code
LanguageList::addLanguage
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/LanguageList.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/LanguageList.java
Apache-2.0
public String getLanguage(final int index) { return this.languages.get(index); }
Returns the language code at the specified index. @param index the index of the language code to get. @return the language code at given index.
LanguageList::getLanguage
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/LanguageList.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/LanguageList.java
Apache-2.0
public int getLanguageCount() { return this.languages.size(); }
Returns the amount of stored language codes. @return number of stored language codes.
LanguageList::getLanguageCount
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/LanguageList.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/LanguageList.java
Apache-2.0
public List<String> getLanguages() { return new ArrayList<String>(this.languages); }
Returns all language codes in list. @return list of language codes.
LanguageList::getLanguages
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/LanguageList.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/LanguageList.java
Apache-2.0
public void removeLanguage(final int index) { this.languages.remove(index); }
Removes the language entry at specified index. @param index index of language to remove.
LanguageList::removeLanguage
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/data/LanguageList.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/LanguageList.java
Apache-2.0
protected EncodingChunkReader() { // NOTHING toDo }
Should not be used for now.
EncodingChunkReader::EncodingChunkReader
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/EncodingChunkReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/EncodingChunkReader.java
Apache-2.0
public boolean canFail() { return false; }
{@inheritDoc}
EncodingChunkReader::canFail
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/EncodingChunkReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/EncodingChunkReader.java
Apache-2.0
public GUID[] getApplyingIds() { return APPLYING.clone(); }
{@inheritDoc}
EncodingChunkReader::getApplyingIds
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/EncodingChunkReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/EncodingChunkReader.java
Apache-2.0
public Chunk read(final GUID guid, final InputStream stream, final long chunkStart) throws IOException { final BigInteger chunkLen = Utils.readBig64(stream); final EncodingChunk result = new EncodingChunk(chunkLen); int readBytes = 24; // Can't be interpreted /* * What do I think of this data, well it seems to be another GUID. Then * followed by a UINT16 indicating a length of data following (by half). * My test files just had the length of one and a two bytes zero. */ stream.skip(20); readBytes += 20; /* * Read the number of strings which will follow */ final int stringCount = Utils.readUINT16(stream); readBytes += 2; /* * Now reading the specified amount of strings. */ for (int i = 0; i < stringCount; i++) { final String curr = Utils.readCharacterSizedString(stream); result.addString(curr); readBytes += 4 + 2 * curr.length(); } stream.skip(chunkLen.longValue() - readBytes); result.setPosition(chunkStart); return result; }
{@inheritDoc}
EncodingChunkReader::read
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/EncodingChunkReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/EncodingChunkReader.java
Apache-2.0
public RandomAccessFileOutputStream(final RandomAccessFile target) { super(); this.targetFile = target; }
Creates an instance.<br> @param target file to write to.
RandomAccessFileOutputStream::RandomAccessFileOutputStream
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/RandomAccessFileOutputStream.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/RandomAccessFileOutputStream.java
Apache-2.0
protected StreamChunkReader() { // Nothing to do }
Shouldn't be used for now.
StreamChunkReader::StreamChunkReader
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/StreamChunkReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/StreamChunkReader.java
Apache-2.0
public boolean canFail() { return true; }
{@inheritDoc}
StreamChunkReader::canFail
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/StreamChunkReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/StreamChunkReader.java
Apache-2.0
public GUID[] getApplyingIds() { return APPLYING.clone(); }
{@inheritDoc}
StreamChunkReader::getApplyingIds
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/StreamChunkReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/StreamChunkReader.java
Apache-2.0
public Chunk read(final GUID guid, final InputStream stream, final long chunkStart) throws IOException { StreamChunk result = null; final BigInteger chunkLength = Utils.readBig64(stream); // Now comes GUID indicating whether stream content type is audio or // video final GUID streamTypeGUID = Utils.readGUID(stream); if (GUID.GUID_AUDIOSTREAM.equals(streamTypeGUID) || GUID.GUID_VIDEOSTREAM.equals(streamTypeGUID)) { // A GUID is indicating whether the stream is error // concealed final GUID errorConcealment = Utils.readGUID(stream); /* * Read the Time Offset */ final long timeOffset = Utils.readUINT64(stream); final long typeSpecificDataSize = Utils.readUINT32(stream); final long streamSpecificDataSize = Utils.readUINT32(stream); /* * Read a bit field. (Contains stream number, and whether the stream * content is encrypted.) */ final int mask = Utils.readUINT16(stream); final int streamNumber = mask & 127; final boolean contentEncrypted = (mask & 0x8000) != 0; /* * Skip a reserved field */ stream.skip(4); /* * very important to set for every stream type. The size of bytes * read by the specific stream type, in order to skip the remaining * unread bytes of the stream chunk. */ long streamSpecificBytes; if (GUID.GUID_AUDIOSTREAM.equals(streamTypeGUID)) { /* * Reading audio specific information */ final AudioStreamChunk audioStreamChunk = new AudioStreamChunk(chunkLength); result = audioStreamChunk; /* * read WAVEFORMATEX and format extension. */ final long compressionFormat = Utils.readUINT16(stream); final long channelCount = Utils.readUINT16(stream); final long samplingRate = Utils.readUINT32(stream); final long avgBytesPerSec = Utils.readUINT32(stream); final long blockAlignment = Utils.readUINT16(stream); final int bitsPerSample = Utils.readUINT16(stream); final int codecSpecificDataSize = Utils.readUINT16(stream); final byte[] codecSpecificData = new byte[codecSpecificDataSize]; stream.read(codecSpecificData); audioStreamChunk.setCompressionFormat(compressionFormat); audioStreamChunk.setChannelCount(channelCount); audioStreamChunk.setSamplingRate(samplingRate); audioStreamChunk.setAverageBytesPerSec(avgBytesPerSec); audioStreamChunk.setErrorConcealment(errorConcealment); audioStreamChunk.setBlockAlignment(blockAlignment); audioStreamChunk.setBitsPerSample(bitsPerSample); audioStreamChunk.setCodecData(codecSpecificData); streamSpecificBytes = 18 + codecSpecificData.length; } else { /* * Reading video specific information */ final VideoStreamChunk videoStreamChunk = new VideoStreamChunk(chunkLength); result = videoStreamChunk; final long pictureWidth = Utils.readUINT32(stream); final long pictureHeight = Utils.readUINT32(stream); // Skip unknown field stream.skip(1); /* * Now read the format specific data */ // Size of the data section (formatDataSize) stream.skip(2); stream.skip(16); final byte[] fourCC = new byte[4]; stream.read(fourCC); videoStreamChunk.setPictureWidth(pictureWidth); videoStreamChunk.setPictureHeight(pictureHeight); videoStreamChunk.setCodecId(fourCC); streamSpecificBytes = 31; } /* * Setting common values for audio and video */ result.setStreamNumber(streamNumber); result.setStreamSpecificDataSize(streamSpecificDataSize); result.setTypeSpecificDataSize(typeSpecificDataSize); result.setTimeOffset(timeOffset); result.setContentEncrypted(contentEncrypted); result.setPosition(chunkStart); /* * Now skip remainder of chunks bytes. chunk-length - 24 (size of * GUID and chunklen) - streamSpecificBytes(stream type specific * data) - 54 (common data) */ stream.skip(chunkLength.longValue() - 24 - streamSpecificBytes - 54); } return result; }
{@inheritDoc}
StreamChunkReader::read
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/StreamChunkReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/StreamChunkReader.java
Apache-2.0
protected ChunkContainerReader(final List<Class<? extends ChunkReader>> toRegister, final boolean readChunkOnce) { this.eachChunkOnce = readChunkOnce; for (final Class<? extends ChunkReader> curr : toRegister) { register(curr); } }
Creates a reader instance, which only utilizes the given list of chunk readers.<br> @param toRegister List of {@link ChunkReader} class instances, which are to be utilized by the instance. @param readChunkOnce if <code>true</code>, each chunk type (identified by chunk GUID) will handled only once, if a reader is available, other chunks will be discarded.
ChunkContainerReader::ChunkContainerReader
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/ChunkContainerReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/ChunkContainerReader.java
Apache-2.0
protected void checkStream(final InputStream stream) throws IllegalArgumentException { if (this.hasFailingReaders && !stream.markSupported()) { throw new IllegalArgumentException("Stream has to support mark/reset."); } }
Checks for the constraints of this class. @param stream stream to test. @throws IllegalArgumentException If stream does not meet the requirements.
ChunkContainerReader::checkStream
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/ChunkContainerReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/ChunkContainerReader.java
Apache-2.0
protected ChunkReader getReader(final GUID guid) { return this.readerMap.get(guid); }
Gets a configured {@linkplain ChunkReader reader} instance for ASF objects (chunks) with the specified <code>guid</code>. @param guid GUID which identifies the chunk to be read. @return an appropriate reader implementation, <code>null</code> if not {@linkplain #register(Class) registered}.
ChunkContainerReader::getReader
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/ChunkContainerReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/ChunkContainerReader.java
Apache-2.0
protected boolean isReaderAvailable(final GUID guid) { return this.readerMap.containsKey(guid); }
Tests whether {@link #getReader(GUID)} won't return <code>null</code>.<br> @param guid GUID which identifies the chunk to be read. @return <code>true</code> if a reader is available.
ChunkContainerReader::isReaderAvailable
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/ChunkContainerReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/ChunkContainerReader.java
Apache-2.0
public ChunkType read(final GUID guid, final InputStream stream, final long chunkStart) throws IOException, IllegalArgumentException { checkStream(stream); final CountingInputStream cis = new CountingInputStream(stream); if (!Arrays.asList(getApplyingIds()).contains(guid)) { throw new IllegalArgumentException("provided GUID is not supported by this reader."); } // For Know the file pointer pointed to an ASF header chunk. final BigInteger chunkLen = Utils.readBig64(cis); /* * now read implementation specific information until the chunk * collection starts and create the resulting object. */ final ChunkType result = createContainer(chunkStart, chunkLen, cis); // 16 bytes have already been for providing the GUID long currentPosition = chunkStart + cis.getReadCount() + 16; final HashSet<GUID> alreadyRead = new HashSet<GUID>(); /* * Now reading header of chuncks. */ while (currentPosition < result.getChunkEnd()) { final GUID currentGUID = Utils.readGUID(cis); final boolean skip = this.eachChunkOnce && (!isReaderAvailable(currentGUID) || !alreadyRead.add(currentGUID)); Chunk chunk; /* * If one reader tells it could fail (new method), then check the * input stream for mark/reset. And use it if failed. */ if (!skip && isReaderAvailable(currentGUID)) { final ChunkReader reader = getReader(currentGUID); if (reader.canFail()) { cis.mark(READ_LIMIT); } chunk = getReader(currentGUID).read(currentGUID, cis, currentPosition); } else { chunk = ChunkHeaderReader.getInstance().read(currentGUID, cis, currentPosition); } if (chunk == null) { /* * Reader failed */ cis.reset(); } else { if (!skip) { result.addChunk(chunk); } currentPosition = chunk.getChunkEnd(); // Always take into account, that 16 bytes have been read prior // to calling this method assert cis.getReadCount() + chunkStart + 16 == currentPosition; } } return result; }
This Method implements the reading of a chunk container.<br> @param guid GUID of the currently read container. @param stream Stream which contains the chunk container. @param chunkStart The start of the chunk container from stream start.<br> For direct file streams one can assume <code>0</code> here. @return <code>null</code> if no valid data found, else a Wrapper containing all supported data. @throws IOException Read errors. @throws IllegalArgumentException If one used {@link ChunkReader} could {@linkplain ChunkReader#canFail() fail} and the stream source doesn't support mark/reset.
ChunkContainerReader::read
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/ChunkContainerReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/ChunkContainerReader.java
Apache-2.0
private <T extends ChunkReader> void register(final Class<T> toRegister) { try { final T reader = toRegister.newInstance(); for (final GUID curr : reader.getApplyingIds()) { this.readerMap.put(curr, reader); } } catch (InstantiationException e) { LOGGER.severe(e.getMessage()); } catch (IllegalAccessException e) { LOGGER.severe(e.getMessage()); } }
Registers the given reader.<br> @param <T> The actual reader implementation. @param toRegister chunk reader which is to be registered.
ChunkContainerReader::register
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/ChunkContainerReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/ChunkContainerReader.java
Apache-2.0
public CountingInputStream(final InputStream stream) { super(stream); this.markPos = 0; this.readCount = 0; }
Creates an instance, which delegates the commands to the given stream. @param stream stream to actually work with.
CountingInputStream::CountingInputStream
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/CountingInputStream.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/CountingInputStream.java
Apache-2.0
private synchronized void bytesRead(final long amountRead) { if (amountRead >= 0) { this.readCount += amountRead; } }
Counts the given amount of bytes. @param amountRead number of bytes to increase.
CountingInputStream::bytesRead
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/CountingInputStream.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/CountingInputStream.java
Apache-2.0
public synchronized long getReadCount() { return this.readCount; }
@return the readCount
CountingInputStream::getReadCount
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/CountingInputStream.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/CountingInputStream.java
Apache-2.0
public boolean canFail() { return false; }
{@inheritDoc}
LanguageListReader::canFail
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/LanguageListReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/LanguageListReader.java
Apache-2.0
public GUID[] getApplyingIds() { return APPLYING.clone(); }
{@inheritDoc}
LanguageListReader::getApplyingIds
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/LanguageListReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/LanguageListReader.java
Apache-2.0
public Chunk read(final GUID guid, final InputStream stream, final long streamPosition) throws IOException { assert GUID.GUID_LANGUAGE_LIST.equals(guid); final BigInteger chunkLen = Utils.readBig64(stream); final int readUINT16 = Utils.readUINT16(stream); final LanguageList result = new LanguageList(streamPosition, chunkLen); for (int i = 0; i < readUINT16; i++) { final int langIdLen = (stream.read() & 0xFF); final String langId = Utils.readFixedSizeUTF16Str(stream, langIdLen); // langIdLen = 2 bytes for each char and optionally one zero // termination character assert langId.length() == langIdLen / 2 - 1 || langId.length() == langIdLen / 2; result.addLanguage(langId); } return result; }
{@inheritDoc}
LanguageListReader::read
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/LanguageListReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/LanguageListReader.java
Apache-2.0
public WriteableChunkModifer(final WriteableChunk chunk) { this.writableChunk = chunk; }
Creates an instance.<br> @param chunk chunk to write
WriteableChunkModifer::WriteableChunkModifer
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/WriteableChunkModifer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/WriteableChunkModifer.java
Apache-2.0
public boolean isApplicable(final GUID guid) { return guid.equals(this.writableChunk.getGuid()); }
{@inheritDoc}
WriteableChunkModifer::isApplicable
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/WriteableChunkModifer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/WriteableChunkModifer.java
Apache-2.0
public ModificationResult modify(final GUID guid, final InputStream chunk, OutputStream destination) throws IOException { // NOPMD by Christian Laireiter on 5/9/09 5:03 PM int chunkDiff = 0; long newSize = 0; long oldSize = 0; /* * Replace the outputstream with the counting one, only if assert's are * evaluated. */ assert (destination = new CountingOutputstream(destination)) != null; if (!this.writableChunk.isEmpty()) { newSize = this.writableChunk.writeInto(destination); assert newSize == this.writableChunk.getCurrentAsfChunkSize(); /* * If assert's are evaluated, we have replaced destination by a * CountingOutpustream and can now verify if * getCurrentAsfChunkSize() really works correctly. */ assert ((CountingOutputstream) destination).getCount() == newSize; if (guid == null) { chunkDiff++; } } if (guid != null) { assert isApplicable(guid); if (this.writableChunk.isEmpty()) { chunkDiff--; } oldSize = Utils.readUINT64(chunk); chunk.skip(oldSize - 24); } return new ModificationResult(chunkDiff, (newSize - oldSize), guid); }
{@inheritDoc}
WriteableChunkModifer::modify
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/WriteableChunkModifer.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/WriteableChunkModifer.java
Apache-2.0
public FullRequestInputStream(final InputStream source) { super(source); }
Creates an instance. @param source stream to read from.
FullRequestInputStream::FullRequestInputStream
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/FullRequestInputStream.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/FullRequestInputStream.java
Apache-2.0
protected EncryptionChunkReader() { // NOTHING toDo }
Should not be used for now.
EncryptionChunkReader::EncryptionChunkReader
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/EncryptionChunkReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/EncryptionChunkReader.java
Apache-2.0
public boolean canFail() { return false; }
{@inheritDoc}
EncryptionChunkReader::canFail
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/EncryptionChunkReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/EncryptionChunkReader.java
Apache-2.0
public GUID[] getApplyingIds() { return APPLYING.clone(); }
{@inheritDoc}
EncryptionChunkReader::getApplyingIds
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/EncryptionChunkReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/EncryptionChunkReader.java
Apache-2.0
public Chunk read(final GUID guid, final InputStream stream, final long chunkStart) throws IOException { EncryptionChunk result; final BigInteger chunkLen = Utils.readBig64(stream); result = new EncryptionChunk(chunkLen); // Can't be interpreted /* * Object ID GUID 128 Object Size QWORD 64 Secret Data Length DWORD 32 * Secret Data INTEGER varies Protection Type Length DWORD 32 Protection * Type char varies Key ID Length DWORD 32 Key ID char varies License * URL Length DWORD 32 License URL char varies * Read the */ byte[] secretData; byte[] protectionType; byte[] keyID; byte[] licenseURL; // Secret Data length int fieldLength; fieldLength = (int) Utils.readUINT32(stream); // Secret Data secretData = new byte[fieldLength + 1]; stream.read(secretData, 0, fieldLength); secretData[fieldLength] = 0; // Protection type Length fieldLength = 0; fieldLength = (int) Utils.readUINT32(stream); // Protection Data Length protectionType = new byte[fieldLength + 1]; stream.read(protectionType, 0, fieldLength); protectionType[fieldLength] = 0; // Key ID length fieldLength = 0; fieldLength = (int) Utils.readUINT32(stream); // Key ID keyID = new byte[fieldLength + 1]; stream.read(keyID, 0, fieldLength); keyID[fieldLength] = 0; // License URL length fieldLength = 0; fieldLength = (int) Utils.readUINT32(stream); // License URL licenseURL = new byte[fieldLength + 1]; stream.read(licenseURL, 0, fieldLength); licenseURL[fieldLength] = 0; result.setSecretData(new String(secretData)); result.setProtectionType(new String(protectionType)); result.setKeyID(new String(keyID)); result.setLicenseURL(new String(licenseURL)); result.setPosition(chunkStart); return result; }
{@inheritDoc}
EncryptionChunkReader::read
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/EncryptionChunkReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/EncryptionChunkReader.java
Apache-2.0
public AsfExtHeaderReader(final List<Class<? extends ChunkReader>> toRegister, final boolean readChunkOnce) { super(toRegister, readChunkOnce); }
Creates a reader instance, which only utilizes the given list of chunk readers.<br> @param toRegister List of {@link ChunkReader} class instances, which are to be utilized by the instance. @param readChunkOnce if <code>true</code>, each chunk type (identified by chunk GUID) will handled only once, if a reader is available, other chunks will be discarded.
AsfExtHeaderReader::AsfExtHeaderReader
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/AsfExtHeaderReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/AsfExtHeaderReader.java
Apache-2.0
public boolean canFail() { return false; }
{@inheritDoc}
AsfExtHeaderReader::canFail
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/AsfExtHeaderReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/AsfExtHeaderReader.java
Apache-2.0
public GUID[] getApplyingIds() { return APPLYING.clone(); }
{@inheritDoc}
AsfExtHeaderReader::getApplyingIds
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/AsfExtHeaderReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/AsfExtHeaderReader.java
Apache-2.0
protected ContentDescriptionReader() { // NOTHING toDo }
Should not be used for now.
ContentDescriptionReader::ContentDescriptionReader
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/ContentDescriptionReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/ContentDescriptionReader.java
Apache-2.0
public boolean canFail() { return false; }
{@inheritDoc}
ContentDescriptionReader::canFail
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/audio/asf/io/ContentDescriptionReader.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/io/ContentDescriptionReader.java
Apache-2.0