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 void setId(int length)
{
byte[] headerSize = Utils.getSizeBEInt32(length);
dataBuffer.put(5, headerSize[0]);
dataBuffer.put(6, headerSize[1]);
dataBuffer.put(7, headerSize[2]);
dataBuffer.put(8, headerSize[3]);
this.length = length;
} |
Set the Id.
Allows you to manully create a header
This will modify the databuffer accordingly
@param length
| Mp4BoxHeader::setId | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | Apache-2.0 |
public ByteBuffer getHeaderData()
{
dataBuffer.rewind();
return dataBuffer;
} |
@return the 8 byte header buffer
| Mp4BoxHeader::getHeaderData | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | Apache-2.0 |
public int getDataLength()
{
return length - HEADER_LENGTH;
} |
@return the length of the data only (does not include the header size)
| Mp4BoxHeader::getDataLength | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | Apache-2.0 |
public Charset getEncoding()
{
return StandardCharsets.UTF_8;
} |
@return UTF_8 (always used by Mp4)
| Mp4BoxHeader::getEncoding | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | Apache-2.0 |
public static Mp4BoxHeader seekWithinLevel(FileChannel fc, String id) throws IOException
{
logger.finer("Started searching for:" + id + " in file at:" + fc.position());
Mp4BoxHeader boxHeader = new Mp4BoxHeader();
ByteBuffer headerBuffer = ByteBuffer.allocate(HEADER_LENGTH);
int bytesRead = fc.read(headerBuffer);
if (bytesRead != HEADER_LENGTH)
{
return null;
}
headerBuffer.rewind();
boxHeader.update(headerBuffer);
while (!boxHeader.getId().equals(id))
{
logger.finer("Found:" + boxHeader.getId() + " Still searching for:" + id + " in file at:" + fc.position());
//Something gone wrong probably not at the start of an atom so return null;
if (boxHeader.getLength() < Mp4BoxHeader.HEADER_LENGTH)
{
return null;
}
fc.position(fc.position() + boxHeader.getDataLength());
if (fc.position() > fc.size())
{
return null;
}
headerBuffer.rewind();
bytesRead = fc.read(headerBuffer);
logger.finer("Header Bytes Read:" + bytesRead);
headerBuffer.rewind();
if (bytesRead == Mp4BoxHeader.HEADER_LENGTH)
{
boxHeader.update(headerBuffer);
}
else
{
return null;
}
}
return boxHeader;
} |
Seek for box with the specified id starting from the current location of filepointer,
Note it wont find the box if it is contained with a level below the current level, nor if we are
at a parent atom that also contains data and we havent yet processed the data. It will work
if we are at the start of a child box even if it not the required box as long as the box we are
looking for is the same level (or the level above in some cases).
@param fc
@param id
@throws java.io.IOException
@return
| Mp4BoxHeader::seekWithinLevel | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | Apache-2.0 |
public static Mp4BoxHeader seekWithinLevel(ByteBuffer data, String id) throws IOException
{
logger.finer("Started searching for:" + id + " in bytebuffer at" + data.position());
Mp4BoxHeader boxHeader = new Mp4BoxHeader();
if (data.remaining() >= Mp4BoxHeader.HEADER_LENGTH)
{
boxHeader.update(data);
}
else
{
return null;
}
while (!boxHeader.getId().equals(id))
{
logger.finer("Found:" + boxHeader.getId() + " Still searching for:" + id + " in bytebuffer at" + data.position());
//Something gone wrong probably not at the start of an atom so return null;
if (boxHeader.getLength() < Mp4BoxHeader.HEADER_LENGTH)
{
return null;
}
if(data.remaining()<(boxHeader.getLength() - HEADER_LENGTH))
{
//i.e Could happen if Moov header had size incorrectly recorded
return null;
}
data.position(data.position() + (boxHeader.getLength() - HEADER_LENGTH));
if (data.remaining() >= Mp4BoxHeader.HEADER_LENGTH)
{
boxHeader.update(data);
}
else
{
return null;
}
}
logger.finer("Found:" + id + " in bytebuffer at" + data.position());
return boxHeader;
} |
Seek for box with the specified id starting from the current location of filepointer,
Note it won't find the box if it is contained with a level below the current level, nor if we are
at a parent atom that also contains data and we havent yet processed the data. It will work
if we are at the start of a child box even if it not the required box as long as the box we are
looking for is the same level (or the level above in some cases).
@param data
@param id
@throws java.io.IOException
@return
| Mp4BoxHeader::seekWithinLevel | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | Apache-2.0 |
public long getFilePos()
{
return filePos;
} |
@return location in file of the start of atom header (i.e where the 4 byte length field starts)
| Mp4BoxHeader::getFilePos | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | Apache-2.0 |
public long getFileEndPos()
{
return filePos + length;
} |
@return location in file of the end of atom
| Mp4BoxHeader::getFileEndPos | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | Apache-2.0 |
public void setFilePos(long filePos)
{
this.filePos = filePos;
} |
Set location in file of the start of file header (i.e where the 4 byte length field starts)
@param filePos
| Mp4BoxHeader::setFilePos | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4BoxHeader.java | Apache-2.0 |
public Mp4StcoBox(Mp4BoxHeader header, ByteBuffer buffer)
{
this.header = header;
//Make a slice of databuffer then we can work with relative or absolute methods safetly
dataBuffer = buffer.slice();
dataBuffer.order(ByteOrder.BIG_ENDIAN);
//Skip the flags
dataBuffer.position(dataBuffer.position() + VERSION_FLAG_LENGTH + OTHER_FLAG_LENGTH);
//No of offsets
this.noOfOffSets = dataBuffer.getInt();
//First Offset, useful for sanity checks
firstOffSet = dataBuffer.getInt();
} |
Construct box from data and show contents
@param header header info
@param buffer data of box (doesnt include header data)
| Mp4StcoBox::Mp4StcoBox | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4StcoBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4StcoBox.java | Apache-2.0 |
public void printAllOffsets()
{
System.out.println("Print Offsets:start");
dataBuffer.rewind();
dataBuffer.position(VERSION_FLAG_LENGTH + OTHER_FLAG_LENGTH + NO_OF_OFFSETS_LENGTH);
for (int i = 0; i < noOfOffSets - 1; i++)
{
int offset = dataBuffer.getInt();
System.out.println("offset into audio data is:" + offset);
}
int offset = dataBuffer.getInt();
System.out.println("offset into audio data is:" + offset);
System.out.println("Print Offsets:end");
} |
Show All offsets, useful for debugging
| Mp4StcoBox::printAllOffsets | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4StcoBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4StcoBox.java | Apache-2.0 |
public Mp4StcoBox(Mp4BoxHeader header, ByteBuffer originalDataBuffer, int adjustment)
{
this.header = header;
//Make a slice of databuffer then we can work with relative or absolute methods safetly
this.dataBuffer = originalDataBuffer.slice();
//Skip the flags
dataBuffer.position(dataBuffer.position() + VERSION_FLAG_LENGTH + OTHER_FLAG_LENGTH);
//No of offsets
this.noOfOffSets = Utils.getIntBE(dataBuffer, dataBuffer.position(), (dataBuffer.position() + NO_OF_OFFSETS_LENGTH - 1));
dataBuffer.position(dataBuffer.position() + NO_OF_OFFSETS_LENGTH);
for (int i = 0; i < noOfOffSets; i++)
{
int offset = Utils.getIntBE(dataBuffer, dataBuffer.position(), (dataBuffer.position() + NO_OF_OFFSETS_LENGTH - 1));
//Calculate new offset and update buffer
offset = offset + adjustment;
dataBuffer.put(Utils.getSizeBEInt32(offset));
}
} |
Construct box from data and adjust offets accordingly
@param header header info
@param originalDataBuffer data of box (doesnt include header data)
@param adjustment
| Mp4StcoBox::Mp4StcoBox | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4StcoBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4StcoBox.java | Apache-2.0 |
public int getNoOfOffSets()
{
return noOfOffSets;
} |
The number of offsets
@return
| Mp4StcoBox::getNoOfOffSets | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4StcoBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4StcoBox.java | Apache-2.0 |
public int getFirstOffSet()
{
return firstOffSet;
} |
The value of the first offset
@return
| Mp4StcoBox::getFirstOffSet | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4StcoBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4StcoBox.java | Apache-2.0 |
public Mp4MetaBox(Mp4BoxHeader header, ByteBuffer dataBuffer)
{
this.header = header;
this.dataBuffer = dataBuffer;
} |
@param header header info
@param dataBuffer data of box (doesn't include header data)
| Mp4MetaBox::Mp4MetaBox | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4MetaBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4MetaBox.java | Apache-2.0 |
public static Mp4MetaBox createiTunesStyleMetaBox(int childrenSize)
{
Mp4BoxHeader metaHeader = new Mp4BoxHeader(Mp4AtomIdentifier.META.getFieldName());
metaHeader.setLength(Mp4BoxHeader.HEADER_LENGTH + Mp4MetaBox.FLAGS_LENGTH + childrenSize);
ByteBuffer metaData = ByteBuffer.allocate(Mp4MetaBox.FLAGS_LENGTH);
Mp4MetaBox metaBox = new Mp4MetaBox(metaHeader,metaData);
return metaBox;
} |
Create an iTunes style Meta box
<p>Useful when writing to mp4 that previously didn't contain an mp4 meta atom
@param childrenSize
@return
| Mp4MetaBox::createiTunesStyleMetaBox | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4MetaBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4MetaBox.java | Apache-2.0 |
public Mp4AlacBox(Mp4BoxHeader header, ByteBuffer dataBuffer)
{
this.header = header;
this.dataBuffer = dataBuffer;
} |
DataBuffer must start from from the start of the body
@param header header info
@param dataBuffer data of box (doesnt include header data)
| Mp4AlacBox::Mp4AlacBox | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4AlacBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4AlacBox.java | Apache-2.0 |
public Mp4StsdBox(Mp4BoxHeader header, ByteBuffer dataBuffer)
{
this.header = header;
this.dataBuffer = dataBuffer;
} |
@param header header info
@param dataBuffer data of box (doesnt include header data)
| Mp4StsdBox::Mp4StsdBox | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4StsdBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4StsdBox.java | Apache-2.0 |
public Mp4EsdsBox(Mp4BoxHeader header, ByteBuffer dataBuffer)
{
this.header = header;
dataBuffer.order(ByteOrder.BIG_ENDIAN);
//Not currently used, as lengths can extend over more than one section i think
int sectionThreeLength;
int sectionFourLength;
int sectionFiveLength;
int sectionSixLength;
//As explained earlier the length of this atom is not fixed so processing is a bit more difficult
//Process Flags
dataBuffer.position(dataBuffer.position() + VERSION_FLAG_LENGTH + OTHER_FLAG_LENGTH);
//Process Section 3 if exists
if (dataBuffer.get() == SECTION_THREE)
{
sectionThreeLength = processSectionHeader(dataBuffer);
//Skip Other Section 3 data
dataBuffer.position(dataBuffer.position() + ES_ID_LENGTH + STREAM_PRIORITY_LENGTH);
}
//Process Section 4 (to getFields type and bitrate)
if (dataBuffer.get() == SECTION_FOUR)
{
sectionFourLength = processSectionHeader(dataBuffer);
//kind (in iTunes)
kind = kindMap.get((int) dataBuffer.get());
//Skip Other Section 4 data
dataBuffer.position(dataBuffer.position() + STREAM_TYPE_LENGTH + BUFFER_SIZE_LENGTH);
//Bit rates
this.maxBitrate = dataBuffer.getInt();
this.avgBitrate = dataBuffer.getInt();
}
//Process Section 5,(to getFields no of channels and audioprofile(profile in itunes))
if (dataBuffer.get() == SECTION_FIVE)
{
sectionFiveLength = processSectionHeader(dataBuffer);
//Audio Profile
audioProfile = audioProfileMap.get((dataBuffer.get() >> 3));
//Channels
byte channelByte = dataBuffer.get();
numberOfChannels = (channelByte << 1) >> 4;
}
//Process Section 6, not needed ...
} |
DataBuffer must start from from the start of the body
@param header header info
@param dataBuffer data of box (doesnt include header data)
| Mp4EsdsBox::Mp4EsdsBox | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4EsdsBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4EsdsBox.java | Apache-2.0 |
public int getMaxBitrate()
{
return maxBitrate;
} |
@return maximum bit rate (bps)
| Mp4EsdsBox::getMaxBitrate | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4EsdsBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4EsdsBox.java | Apache-2.0 |
public int getAvgBitrate()
{
return avgBitrate;
} |
@return average bit rate (bps)
| Mp4EsdsBox::getAvgBitrate | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4EsdsBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4EsdsBox.java | Apache-2.0 |
public int processSectionHeader(ByteBuffer dataBuffer)
{
int datalength;
byte nextByte = dataBuffer.get();
if (((nextByte & 0xFF) == FILLER_START) || ((nextByte & 0xFF) == FILLER_OTHER) || ((nextByte & 0xFF) == FILLER_END))
{
dataBuffer.get();
dataBuffer.get();
datalength = Utils.u(dataBuffer.get());
}
else
{
datalength = Utils.u(nextByte);
}
return datalength;
} |
Process header, skipping filler bytes and calculating size
@param dataBuffer
@return section header
| Mp4EsdsBox::processSectionHeader | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4EsdsBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4EsdsBox.java | Apache-2.0 |
public Kind getKind()
{
return kind;
} |
Only expext MPG_Audio,
TODO shouldnt matter if another type of audio, but something gone wrong if type of video
@return the file type for the track
| Mp4EsdsBox::getKind | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4EsdsBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4EsdsBox.java | Apache-2.0 |
public AudioProfile getAudioProfile()
{
return audioProfile;
} |
Get audio profile, usually AAC Low Complexity
@return the audio profile
| Mp4EsdsBox::getAudioProfile | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4EsdsBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4EsdsBox.java | Apache-2.0 |
AudioProfile(int id, String description)
{
this.id = id;
this.description = description;
} |
@param id it is stored as in file
@param description human readable description
| AudioProfile::AudioProfile | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4EsdsBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4EsdsBox.java | Apache-2.0 |
public Mp4MvhdBox(Mp4BoxHeader header, ByteBuffer dataBuffer)
{
this.header = header;
dataBuffer.order(ByteOrder.BIG_ENDIAN);
byte version = dataBuffer.get(VERSION_FLAG_POS);
if (version == LONG_FORMAT)
{
timeScale = dataBuffer.getInt(TIMESCALE_LONG_POS);
timeLength = dataBuffer.getLong(DURATION_LONG_POS);
}
else
{
timeScale = dataBuffer.getInt(TIMESCALE_SHORT_POS);
timeLength = Utils.u(dataBuffer.getInt(DURATION_SHORT_POS));
}
} |
@param header header info
@param dataBuffer data of box (doesnt include header data)
| Mp4MvhdBox::Mp4MvhdBox | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4MvhdBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4MvhdBox.java | Apache-2.0 |
public Mp4HdlrBox(Mp4BoxHeader header, ByteBuffer dataBuffer)
{
this.header = header;
this.dataBuffer = dataBuffer;
} |
DataBuffer must start from from the start of the body
@param header header info
@param dataBuffer data of box (doesnt include header data)
| Mp4HdlrBox::Mp4HdlrBox | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4HdlrBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4HdlrBox.java | Apache-2.0 |
public static Mp4HdlrBox createiTunesStyleHdlrBox()
{
Mp4BoxHeader hdlrHeader = new Mp4BoxHeader(Mp4AtomIdentifier.HDLR.getFieldName());
hdlrHeader.setLength(Mp4BoxHeader.HEADER_LENGTH + Mp4HdlrBox.ITUNES_META_HDLR_DAT_LENGTH);
ByteBuffer hdlrData = ByteBuffer.allocate(Mp4HdlrBox.ITUNES_META_HDLR_DAT_LENGTH);
hdlrData.put(HANDLER_POS,(byte)0x6d); //mdir
hdlrData.put(HANDLER_POS+1,(byte)0x64);
hdlrData.put(HANDLER_POS+2,(byte)0x69);
hdlrData.put(HANDLER_POS+3,(byte)0x72);
hdlrData.put(RESERVED1_POS,(byte)0x61); //appl
hdlrData.put(RESERVED1_POS+1,(byte)0x70);
hdlrData.put(RESERVED1_POS+2,(byte)0x70);
hdlrData.put(RESERVED1_POS+3,(byte)0x6c);
hdlrData.rewind();
Mp4HdlrBox hdlrBox = new Mp4HdlrBox(hdlrHeader,hdlrData);
return hdlrBox;
} |
Create an iTunes style Hdlr box for use within Meta box
<p>Useful when writing to mp4 that previously didn't contain an mp4 meta atom
<p>Doesnt write the child data but uses it to set the header length, only sets the atoms immediate
data</p>
@return
| MediaDataType::createiTunesStyleHdlrBox | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4HdlrBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4HdlrBox.java | Apache-2.0 |
public Mp4FreeBox(int datasize)
{
try
{
//Header
header = new Mp4BoxHeader();
ByteArrayOutputStream headerBaos = new ByteArrayOutputStream();
headerBaos.write(Utils.getSizeBEInt32(Mp4BoxHeader.HEADER_LENGTH + datasize));
headerBaos.write(Mp4AtomIdentifier.FREE.getFieldName().getBytes(StandardCharsets.ISO_8859_1));
header.update(ByteBuffer.wrap(headerBaos.toByteArray()));
//Body
ByteArrayOutputStream freeBaos = new ByteArrayOutputStream();
for (int i = 0; i < datasize; i++)
{
freeBaos.write(0x0);
}
dataBuffer = ByteBuffer.wrap(freeBaos.toByteArray());
}
catch (IOException ioe)
{
//This should never happen as were not actually writing to/from a file
throw new RuntimeException(ioe);
}
} |
Construct a new FreeBox containing datasize padding (i.e doesnt include header size)
@param datasize padding size
| Mp4FreeBox::Mp4FreeBox | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4FreeBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4FreeBox.java | Apache-2.0 |
public Mp4BoxHeader getHeader()
{
return header;
} |
@return the box header
| AbstractMp4Box::getHeader | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/AbstractMp4Box.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/AbstractMp4Box.java | Apache-2.0 |
public ByteBuffer getData()
{
return dataBuffer;
} |
@return rawdata of this box
| AbstractMp4Box::getData | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/AbstractMp4Box.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/AbstractMp4Box.java | Apache-2.0 |
public Mp4MdhdBox(Mp4BoxHeader header, ByteBuffer dataBuffer)
{
this.header = header;
dataBuffer.order(ByteOrder.BIG_ENDIAN);
byte version = dataBuffer.get(VERSION_FLAG_POS);
if (version == LONG_FORMAT)
{
this.samplingRate = dataBuffer.getInt(TIMESCALE_LONG_POS);
timeLength = dataBuffer.getLong(DURATION_LONG_POS);
}
else
{
this.samplingRate = dataBuffer.getInt(TIMESCALE_SHORT_POS);
timeLength = Utils.u(dataBuffer.getInt(DURATION_SHORT_POS));
}
} |
@param header header info
@param dataBuffer data of box (doesnt include header data)
| Mp4MdhdBox::Mp4MdhdBox | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4MdhdBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4MdhdBox.java | Apache-2.0 |
public Mp4Mp4aBox(Mp4BoxHeader header, ByteBuffer dataBuffer)
{
this.header = header;
this.dataBuffer = dataBuffer;
} |
@param header header info
@param dataBuffer data of box (doesnt include header data)
| Mp4Mp4aBox::Mp4Mp4aBox | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4Mp4aBox.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/mp4/atom/Mp4Mp4aBox.java | Apache-2.0 |
private boolean determineVariableBitrate(final AsfHeader header)
{
assert header != null;
boolean result = false;
final MetadataContainer extDesc = header.findExtendedContentDescription();
if (extDesc != null)
{
final List<MetadataDescriptor> descriptors = extDesc.getDescriptorsByName("IsVBR");
if (descriptors != null && !descriptors.isEmpty())
{
result = Boolean.TRUE.toString().equals(descriptors.get(0).getString());
}
}
return result;
} |
Determines if the "isVbr" field is set in the extended content
description.<br>
@param header the header to look up.
@return <code>true</code> if "isVbr" is present with a
<code>true</code> value.
| AsfFileReader::determineVariableBitrate | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/AsfFileReader.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/AsfFileReader.java | Apache-2.0 |
private GenericAudioHeader getAudioHeader(final AsfHeader header) throws CannotReadException
{
final GenericAudioHeader info = new GenericAudioHeader();
if (header.getFileHeader() == null)
{
throw new CannotReadException("Invalid ASF/WMA file. File header object not available.");
}
if (header.getAudioStreamChunk() == null)
{
throw new CannotReadException("Invalid ASF/WMA file. No audio stream contained.");
}
info.setBitRate(header.getAudioStreamChunk().getKbps());
info.setChannelNumber((int) header.getAudioStreamChunk().getChannelCount());
info.setEncodingType("ASF (audio): " + header.getAudioStreamChunk().getCodecDescription());
info.setLossless(header.getAudioStreamChunk().getCompressionFormat() == AudioStreamChunk.WMA_LOSSLESS);
info.setPreciseLength(header.getFileHeader().getPreciseDuration());
info.setSamplingRate((int) header.getAudioStreamChunk().getSamplingRate());
info.setVariableBitRate(determineVariableBitrate(header));
info.setBitsPerSample(header.getAudioStreamChunk().getBitsPerSample());
return info;
} |
Creates a generic audio header instance with provided data from header.
@param header ASF header which contains the information.
@return generic audio header representation.
@throws CannotReadException If header does not contain mandatory information. (Audio
stream chunk and file header chunk)
| AsfFileReader::getAudioHeader | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/AsfFileReader.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/AsfFileReader.java | Apache-2.0 |
private AsfTag getTag(final AsfHeader header)
{
return TagConverter.createTagOf(header);
} |
Creates a tag instance with provided data from header.
@param header ASF header which contains the information.
@return generic audio header representation.
| AsfFileReader::getTag | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/AsfFileReader.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/AsfFileReader.java | Apache-2.0 |
public static void checkStringLengthNullSafe(String value) throws IllegalArgumentException
{
if (value != null)
{
if (value.length() > MAXIMUM_STRING_LENGTH_ALLOWED)
{
throw new IllegalArgumentException(ErrorMessage.WMA_LENGTH_OF_STRING_IS_TOO_LARGE.getMsg((value.length() * 2))
);
}
}
} |
This method checks given string will not exceed limit in bytes[] when
converted UTF-16LE encoding (2 bytes per character) and checks whether
the length doesn't exceed 65535 bytes. <br>
@param value The string to check.
@throws IllegalArgumentException If byte representation takes more than 65535 bytes.
| Utils::checkStringLengthNullSafe | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static boolean isStringLengthValidNullSafe(String value)
{
if (value != null)
{
return value.length() <= MAXIMUM_STRING_LENGTH_ALLOWED;
}
return true;
} |
@param value String to check for null
@return true unless string is too long
| Utils::isStringLengthValidNullSafe | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static void copy(InputStream source, OutputStream dest, long amount) throws IOException
{
byte[] buf = new byte[8192];
long copied = 0;
while (copied < amount)
{
int toRead = 8192;
if ((amount - copied) < 8192)
{
toRead = (int) (amount - copied);
}
int read = source.read(buf, 0, toRead);
if (read == -1)
{
throw new IOException("Inputstream has to continue for another " + (amount - copied) + " bytes."
);
}
dest.write(buf, 0, read);
copied += read;
}
} |
effectively copies a specified amount of bytes from one stream to
another.
@param source stream to read from
@param dest stream to write to
@param amount amount of bytes to copy
@throws IOException on I/O errors, and if the source stream depletes before all
bytes have been copied.
| Utils::copy | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static void flush(final InputStream source, final OutputStream dest) throws IOException
{
final byte[] buf = new byte[8192];
int read;
while ((read = source.read(buf)) != -1)
{
dest.write(buf, 0, read);
}
} |
Copies all of the source to the destination.<br>
@param source source to read from
@param dest stream to write to
@throws IOException on I/O errors.
| Utils::flush | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static byte[] getBytes(final long value, final int byteCount)
{
byte[] result = new byte[byteCount];
for (int i = 0; i < result.length; i++)
{
result[i] = (byte) ((value >>> (i * 8)) & 0xFF);
}
return result;
} |
This method will create a byte[] at the size of <code>byteCount</code>
and insert the bytes of <code>value</code> (starting from lowset byte)
into it. <br>
You can easily create a Word (16-bit), DWORD (32-bit), QWORD (64 bit) out
of the value, ignoring the original type of value, since java
automatically performs transformations. <br>
<b>Warning: </b> This method works with unsigned numbers only.
@param value The value to be written into the result.
@param byteCount The number of bytes the array has got.
@return A byte[] with the size of <code>byteCount</code> containing the
lower byte values of <code>value</code>.
| Utils::getBytes | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static byte[] getBytes(final String source, final Charset charset)
{
assert charset != null;
assert source != null;
final ByteBuffer encoded = charset.encode(source);
final byte[] result = new byte[encoded.limit()];
encoded.rewind();
encoded.get(result);
return result;
} |
Convenience method to convert the given string into a byte sequence which
has the format of the charset given.
@param source string to convert.
@param charset charset to apply
@return the source's binary representation according to the charset.
| Utils::getBytes | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static GregorianCalendar getDateOf(final BigInteger fileTime)
{
final GregorianCalendar result = new GregorianCalendar();
// Divide by 10 to convert from -4 to -3 (millisecs)
BigInteger time = fileTime.divide(new BigInteger("10"));
// Construct Date taking into the diff between 1601 and 1970
Date date = new Date(time.longValue() - DIFF_BETWEEN_ASF_DATE_AND_JAVA_DATE);
result.setTime(date);
return result;
} |
Date values in ASF files are given in 100 ns (10 exp -4) steps since first
@param fileTime Time in 100ns since 1 jan 1601
@return Calendar holding the date representation.
| Utils::getDateOf | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static boolean isBlank(String toTest)
{
if (toTest == null)
{
return true;
}
for (int i = 0; i < toTest.length(); i++)
{
if (!Character.isWhitespace(toTest.charAt(i)))
{
return false;
}
}
return true;
} |
Tests if the given string is <code>null</code> or just contains
whitespace characters.
@param toTest String to test.
@return see description.
| Utils::isBlank | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static BigInteger readBig64(InputStream stream) throws IOException
{
byte[] bytes = new byte[8];
byte[] oa = new byte[8];
int read = stream.read(bytes);
if (read != 8)
{
// 8 bytes mandatory.
throw new EOFException();
}
for (int i = 0; i < bytes.length; i++)
{
oa[7 - i] = bytes[i];
}
return new BigInteger(oa);
} |
Reads 8 bytes from stream and interprets them as a UINT64 which is
returned as {@link BigInteger}.<br>
@param stream stream to readm from.
@return a BigInteger which represents the read 8 bytes value.
@throws IOException if problem reading bytes
| Utils::readBig64 | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static byte[] readBinary(InputStream stream, long size) throws IOException
{
byte[] result = new byte[(int) size];
stream.read(result);
return result;
} |
Reads <code>size</code> bytes from the stream.<br>
@param stream stream to read from.
@param size amount of bytes to read.
@return the read bytes.
@throws IOException on I/O errors.
| Utils::readBinary | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static String readCharacterSizedString(InputStream stream) throws IOException
{
StringBuilder result = new StringBuilder();
int strLen = readUINT16(stream);
int character = stream.read();
character |= stream.read() << 8;
do
{
if (character != 0)
{
result.append((char) character);
character = stream.read();
character |= stream.read() << 8;
}
}
while (character != 0 || (result.length() + 1) > strLen);
if (strLen != (result.length() + 1))
{
throw new IllegalStateException("Invalid Data for current interpretation"); //$NON-NLS-1$
}
return result.toString();
} |
This method reads a UTF-16 String, which length is given on the number of
characters it consists of. <br>
The stream must be at the number of characters. This number contains the
terminating zero character (UINT16).
@param stream Input source
@return String
@throws IOException read errors
| Utils::readCharacterSizedString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static String readFixedSizeUTF16Str(InputStream stream, int strLen) throws IOException
{
byte[] strBytes = new byte[strLen];
int read = stream.read(strBytes);
if (read == strBytes.length)
{
if (strBytes.length >= 2)
{
/*
* Zero termination is recommended but optional. So check and
* if, remove.
*/
if (strBytes[strBytes.length - 1] == 0 && strBytes[strBytes.length - 2] == 0)
{
byte[] copy = new byte[strBytes.length - 2];
System.arraycopy(strBytes, 0, copy, 0, strBytes.length - 2);
strBytes = copy;
}
}
return new String(strBytes, StandardCharsets.UTF_16LE);
}
throw new IllegalStateException("Couldn't read the necessary amount of bytes.");
} |
This method reads a UTF-16 encoded String. <br>
For the use this method the number of bytes used by current string must
be known. <br>
The ASF specification recommends that those strings end with a
terminating zero. However it also says that it is not always the case.
@param stream Input source
@param strLen Number of bytes the String may take.
@return read String.
@throws IOException read errors.
| Utils::readFixedSizeUTF16Str | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static GUID readGUID(InputStream stream) throws IOException
{
if (stream == null)
{
throw new IllegalArgumentException("Argument must not be null"); //$NON-NLS-1$
}
int[] binaryGuid = new int[GUID.GUID_LENGTH];
for (int i = 0; i < binaryGuid.length; i++)
{
binaryGuid[i] = stream.read();
}
return new GUID(binaryGuid);
} |
This Method reads a GUID (which is a 16 byte long sequence) from the
given <code>raf</code> and creates a wrapper. <br>
<b>Warning </b>: <br>
There is no way of telling if a byte sequence is a guid or not. The next
16 bytes will be interpreted as a guid, whether it is or not.
@param stream Input source.
@return A class wrapping the guid.
@throws IOException happens when the file ends before guid could be extracted.
| Utils::readGUID | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static int readUINT16(InputStream stream) throws IOException
{
int result = stream.read();
result |= stream.read() << 8;
return result;
} |
Reads 2 bytes from stream and interprets them as UINT16.<br>
@param stream stream to read from.
@return UINT16 value
@throws IOException on I/O Errors.
| Utils::readUINT16 | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static long readUINT32(InputStream stream) throws IOException
{
long result = 0;
for (int i = 0; i <= 24; i += 8)
{
// Warning, always cast to long here. Otherwise it will be
// shifted as int, which may produce a negative value, which will
// then be extended to long and assign the long variable a negative
// value.
result |= (long) stream.read() << i;
}
return result;
} |
Reads 4 bytes from stream and interprets them as UINT32.<br>
@param stream stream to read from.
@return UINT32 value
@throws IOException on I/O Errors.
| Utils::readUINT32 | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static long readUINT64(InputStream stream) throws IOException
{
long result = 0;
for (int i = 0; i <= 56; i += 8)
{
// Warning, always cast to long here. Otherwise it will be
// shifted as int, which may produce a negative value, which will
// then be extended to long and assign the long variable a negative
// value.
result |= (long) stream.read() << i;
}
return result;
} |
Reads long as little endian.
@param stream Data source
@return long value
@throws IOException read error, or eof is reached before long is completed
| Utils::readUINT64 | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static String readUTF16LEStr(InputStream stream) throws IOException
{
int strLen = readUINT16(stream);
byte[] buf = new byte[strLen];
int read = stream.read(buf);
if (read == strLen || (strLen == 0 && read == -1))
{
/*
* Check on zero termination
*/
if (buf.length >= 2)
{
if (buf[buf.length - 1] == 0 && buf[buf.length - 2] == 0)
{
byte[] copy = new byte[buf.length - 2];
System.arraycopy(buf, 0, copy, 0, buf.length - 2);
buf = copy;
}
}
return new String(buf, AsfHeader.ASF_CHARSET);
}
throw new IllegalStateException("Invalid Data for current interpretation"); //$NON-NLS-1$
} |
This method reads a UTF-16 encoded String, beginning with a 16-bit value
representing the number of bytes needed. The String is terminated with as
16-bit ZERO. <br>
@param stream Input source
@return read String.
@throws IOException read errors.
| Utils::readUTF16LEStr | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static void writeUINT16(int number, OutputStream out) throws IOException
{
if (number < 0)
{
throw new IllegalArgumentException("positive value expected."); //$NON-NLS-1$
}
byte[] toWrite = new byte[2];
for (int i = 0; i <= 8; i += 8)
{
toWrite[i / 8] = (byte) ((number >> i) & 0xFF);
}
out.write(toWrite);
} |
Writes the given value as UINT16 into the stream.
@param number value to write.
@param out stream to write into.
@throws IOException On I/O errors
| Utils::writeUINT16 | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static void writeUINT32(long number, OutputStream out) throws IOException
{
if (number < 0)
{
throw new IllegalArgumentException("positive value expected."); //$NON-NLS-1$
}
byte[] toWrite = new byte[4];
for (int i = 0; i <= 24; i += 8)
{
toWrite[i / 8] = (byte) ((number >> i) & 0xFF);
}
out.write(toWrite);
} |
Writes the given value as UINT32 into the stream.
@param number value to write.
@param out stream to write into.
@throws IOException On I/O errors
| Utils::writeUINT32 | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public static void writeUINT64(long number, OutputStream out) throws IOException
{
if (number < 0)
{
throw new IllegalArgumentException("positive value expected."); //$NON-NLS-1$
}
byte[] toWrite = new byte[8];
for (int i = 0; i <= 56; i += 8)
{
toWrite[i / 8] = (byte) ((number >> i) & 0xFF);
}
out.write(toWrite);
} |
Writes the given value as UINT64 into the stream.
@param number value to write.
@param out stream to write into.
@throws IOException On I/O errors
| Utils::writeUINT64 | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/Utils.java | Apache-2.0 |
public int compare(final Chunk first, final Chunk second)
{
return Long.valueOf(first.getPosition()).compareTo(second.getPosition());
} |
{@inheritDoc}
| ChunkPositionComparator::compare | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/ChunkPositionComparator.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/ChunkPositionComparator.java | Apache-2.0 |
public static void assignCommonTagValues(Tag tag, MetadataContainer description)
{
assert description.getContainerType() == ContainerType.EXTENDED_CONTENT;
MetadataDescriptor tmp;
if (!Utils.isBlank(tag.getFirst(FieldKey.ALBUM)))
{
tmp = new MetadataDescriptor(description.getContainerType(), AsfFieldKey.ALBUM.getFieldName(), MetadataDescriptor.TYPE_STRING);
tmp.setStringValue(tag.getFirst(FieldKey.ALBUM));
description.removeDescriptorsByName(tmp.getName());
description.addDescriptor(tmp);
}
else
{
description.removeDescriptorsByName(AsfFieldKey.ALBUM.getFieldName());
}
if (!Utils.isBlank(tag.getFirst(FieldKey.TRACK)))
{
tmp = new MetadataDescriptor(description.getContainerType(), AsfFieldKey.TRACK.getFieldName(), MetadataDescriptor.TYPE_STRING);
tmp.setStringValue(tag.getFirst(FieldKey.TRACK));
description.removeDescriptorsByName(tmp.getName());
description.addDescriptor(tmp);
}
else
{
description.removeDescriptorsByName(AsfFieldKey.TRACK.getFieldName());
}
if (!Utils.isBlank(tag.getFirst(FieldKey.YEAR)))
{
tmp = new MetadataDescriptor(description.getContainerType(), AsfFieldKey.YEAR.getFieldName(), MetadataDescriptor.TYPE_STRING);
tmp.setStringValue(tag.getFirst(FieldKey.YEAR));
description.removeDescriptorsByName(tmp.getName());
description.addDescriptor(tmp);
}
else
{
description.removeDescriptorsByName(AsfFieldKey.YEAR.getFieldName());
}
if (!Utils.isBlank(tag.getFirst(FieldKey.GENRE)))
{
// Write Genre String value
tmp = new MetadataDescriptor(description.getContainerType(), AsfFieldKey.GENRE.getFieldName(), MetadataDescriptor.TYPE_STRING);
tmp.setStringValue(tag.getFirst(FieldKey.GENRE));
description.removeDescriptorsByName(tmp.getName());
description.addDescriptor(tmp);
Integer genreNum = GenreTypes.getInstanceOf().getIdForName(tag.getFirst(FieldKey.GENRE));
// ..and if it is one of the standard genre types used the id as
// well
if (genreNum != null)
{
tmp = new MetadataDescriptor(description.getContainerType(), AsfFieldKey.GENRE_ID.getFieldName(), MetadataDescriptor.TYPE_STRING);
tmp.setStringValue("(" + genreNum + ")");
description.removeDescriptorsByName(tmp.getName());
description.addDescriptor(tmp);
}
else
{
description.removeDescriptorsByName(AsfFieldKey.GENRE_ID.getFieldName());
}
}
else
{
description.removeDescriptorsByName(AsfFieldKey.GENRE.getFieldName());
description.removeDescriptorsByName(AsfFieldKey.GENRE_ID.getFieldName());
}
} |
This method assigns those tags of <code>tag</code> which are defined to
be common by jaudiotagger. <br>
@param tag The tag from which the values are gathered. <br>
Assigned values are: <br>
@param description The extended content description which should receive the
values. <br>
<b>Warning: </b> the common values will be replaced.
| TagConverter::assignCommonTagValues | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/TagConverter.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/TagConverter.java | Apache-2.0 |
public static AsfTag createTagOf(AsfHeader source)
{
// TODO do we need to copy here.
AsfTag result = new AsfTag(true);
for (int i = 0; i < ContainerType.values().length; i++)
{
MetadataContainer current = source.findMetadataContainer(ContainerType.values()[i]);
if (current != null)
{
List<MetadataDescriptor> descriptors = current.getDescriptors();
for (MetadataDescriptor descriptor : descriptors)
{
AsfTagField toAdd;
if (descriptor.getType() == MetadataDescriptor.TYPE_BINARY)
{
if (descriptor.getName().equals(AsfFieldKey.COVER_ART.getFieldName()))
{
toAdd = new AsfTagCoverField(descriptor);
}
else if (descriptor.getName().equals(AsfFieldKey.BANNER_IMAGE.getFieldName()))
{
toAdd = new AsfTagBannerField(descriptor);
}
else
{
toAdd = new AsfTagField(descriptor);
}
}
else
{
toAdd = new AsfTagTextField(descriptor);
}
result.addField(toAdd);
}
}
}
return result;
} |
This method creates a {@link Tag}and fills it with the contents of the
given {@link AsfHeader}.<br>
@param source The ASF header which contains the information. <br>
@return A Tag with all its values.
| TagConverter::createTagOf | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/TagConverter.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/TagConverter.java | Apache-2.0 |
public static MetadataContainer[] distributeMetadata(final AsfTag tag)
{
final Iterator<AsfTagField> asfFields = tag.getAsfFields();
final MetadataContainer[] createContainers = MetadataContainerFactory.getInstance().createContainers(ContainerType.getOrdered());
boolean assigned;
AsfTagField current;
while (asfFields.hasNext())
{
current = asfFields.next();
assigned = false;
for (int i = 0; !assigned && i < createContainers.length; i++)
{
if (ContainerType.areInCorrectOrder(createContainers[i].getContainerType(), AsfFieldKey.getAsfFieldKey(current.getId()).getHighestContainer()))
{
if (createContainers[i].isAddSupported(current.getDescriptor()))
{
createContainers[i].addDescriptor(current.getDescriptor());
assigned = true;
}
}
}
assert assigned;
}
return createContainers;
} |
This method distributes the tags fields among the
{@linkplain ContainerType#getOrdered()} {@linkplain MetadataContainer
containers}.
@param tag the tag with the fields to distribute.
@return distribution
| TagConverter::distributeMetadata | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/TagConverter.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/TagConverter.java | Apache-2.0 |
private TagConverter()
{
// Nothing to do.
} |
Hidden utility class constructor.
| TagConverter::TagConverter | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/util/TagConverter.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/util/TagConverter.java | Apache-2.0 |
public Chunk(final GUID headerGuid, final BigInteger chunkLen)
{
if (headerGuid == null)
{
throw new IllegalArgumentException("GUID must not be null.");
}
if (chunkLen == null || chunkLen.compareTo(BigInteger.ZERO) < 0)
{
throw new IllegalArgumentException("chunkLen must not be null nor negative.");
}
this.guid = headerGuid;
this.chunkLength = chunkLen;
} |
Creates an instance
@param headerGuid The GUID of header object.
@param chunkLen Length of current chunk.
| Chunk::Chunk | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | Apache-2.0 |
public Chunk(final GUID headerGuid, final long pos, final BigInteger chunkLen)
{
if (headerGuid == null)
{
throw new IllegalArgumentException("GUID must not be null");
}
if (pos < 0)
{
throw new IllegalArgumentException("Position of header can't be negative.");
}
if (chunkLen == null || chunkLen.compareTo(BigInteger.ZERO) < 0)
{
throw new IllegalArgumentException("chunkLen must not be null nor negative.");
}
this.guid = headerGuid;
this.position = pos;
this.chunkLength = chunkLen;
} |
Creates an instance
@param headerGuid The GUID of header object.
@param pos Position of header object within stream or file.
@param chunkLen Length of current chunk.
| Chunk::Chunk | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | Apache-2.0 |
public long getChunkEnd()
{
return this.position + this.chunkLength.longValue();
} |
This method returns the End of the current chunk introduced by current
header object.
@return Position after current chunk.
| Chunk::getChunkEnd | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | Apache-2.0 |
public BigInteger getChunkLength()
{
return this.chunkLength;
} |
@return Returns the chunkLength.
| Chunk::getChunkLength | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | Apache-2.0 |
public GUID getGuid()
{
return this.guid;
} |
@return Returns the guid.
| Chunk::getGuid | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | Apache-2.0 |
public long getPosition()
{
return this.position;
} |
@return Returns the position.
| Chunk::getPosition | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | Apache-2.0 |
public String prettyPrint(final String prefix)
{
String result = prefix + "-> GUID: " + GUID.getGuidDescription(this.guid) + Utils.LINE_SEPARATOR +
prefix + " | : Starts at position: " + getPosition() + Utils.LINE_SEPARATOR +
prefix + " | : Last byte at: " + (getChunkEnd() - 1) + Utils.LINE_SEPARATOR;
return result;
} |
This method creates a String containing useful information prepared to be
printed on STD-OUT. <br>
This method is intended to be overwritten by inheriting classes.
@param prefix each line gets this string prepended.
@return Information of current Chunk Object.
| Chunk::prettyPrint | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | Apache-2.0 |
public void setPosition(final long pos)
{
this.position = pos;
} |
Sets the position.
@param pos position to set.
| Chunk::setPosition | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/Chunk.java | Apache-2.0 |
public AsfExtendedHeader(final long pos, final BigInteger length)
{
super(GUID.GUID_HEADER_EXTENSION, pos, length);
} |
Creates an instance.<br>
@param pos Position within the stream.<br>
@param length the length of the extended header object.
| AsfExtendedHeader::AsfExtendedHeader | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/AsfExtendedHeader.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/AsfExtendedHeader.java | Apache-2.0 |
public ContentDescription getContentDescription()
{
return (ContentDescription) getFirst(GUID.GUID_CONTENTDESCRIPTION, ContentDescription.class);
} |
@return Returns the contentDescription.
| AsfExtendedHeader::getContentDescription | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/AsfExtendedHeader.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/AsfExtendedHeader.java | Apache-2.0 |
public ContentDescription()
{
this(0, BigInteger.ZERO);
} |
Creates an instance. <br>
| ContentDescription::ContentDescription | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | Apache-2.0 |
public ContentDescription(final long pos, final BigInteger chunkLen)
{
super(ContainerType.CONTENT_DESCRIPTION, pos, chunkLen);
} |
Creates an instance.
@param pos Position of content description within file or stream
@param chunkLen Length of content description.
| ContentDescription::ContentDescription | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | Apache-2.0 |
public String getAuthor()
{
return getValueFor(KEY_AUTHOR);
} |
@return Returns the author.
| ContentDescription::getAuthor | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | Apache-2.0 |
public String getComment()
{
return getValueFor(KEY_DESCRIPTION);
} |
@return Returns the comment.
| ContentDescription::getComment | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | Apache-2.0 |
public String getCopyRight()
{
return getValueFor(KEY_COPYRIGHT);
} |
@return Returns the copyRight.
| ContentDescription::getCopyRight | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | Apache-2.0 |
public String getRating()
{
return getValueFor(KEY_RATING);
} |
@return returns the rating.
| ContentDescription::getRating | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | Apache-2.0 |
public String getTitle()
{
return getValueFor(KEY_TITLE);
} |
@return Returns the title.
| ContentDescription::getTitle | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | Apache-2.0 |
public void setAuthor(final String fileAuthor) throws IllegalArgumentException
{
setStringValue(KEY_AUTHOR, fileAuthor);
} |
@param fileAuthor The author to set.
@throws IllegalArgumentException If "UTF-16LE"-byte-representation would take more than 65535
bytes.
| ContentDescription::setAuthor | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | Apache-2.0 |
public void setComment(final String tagComment) throws IllegalArgumentException
{
setStringValue(KEY_DESCRIPTION, tagComment);
} |
@param tagComment The comment to set.
@throws IllegalArgumentException If "UTF-16LE"-byte-representation would take more than 65535
bytes.
| ContentDescription::setComment | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | Apache-2.0 |
public void setCopyright(final String cpright) throws IllegalArgumentException
{
setStringValue(KEY_COPYRIGHT, cpright);
} |
@param cpright The copyRight to set.
@throws IllegalArgumentException If "UTF-16LE"-byte-representation would take more than 65535
bytes.
| ContentDescription::setCopyright | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | Apache-2.0 |
public void setRating(final String ratingText) throws IllegalArgumentException
{
setStringValue(KEY_RATING, ratingText);
} |
@param ratingText The rating to be set.
@throws IllegalArgumentException If "UTF-16LE"-byte-representation would take more than 65535
bytes.
| ContentDescription::setRating | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | Apache-2.0 |
public void setTitle(final String songTitle) throws IllegalArgumentException
{
setStringValue(KEY_TITLE, songTitle);
} |
@param songTitle The title to set.
@throws IllegalArgumentException If "UTF-16LE"-byte-representation would take more than 65535
bytes.
| ContentDescription::setTitle | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContentDescription.java | Apache-2.0 |
public static boolean areInCorrectOrder(final ContainerType low, final ContainerType high)
{
final List<ContainerType> asList = Arrays.asList(getOrdered());
return asList.indexOf(low) <= asList.indexOf(high);
} |
Determines if low has index as high, in respect to
{@link #getOrdered()}
@param low
@param high
@return <code>true</code> if in correct order.
| ContainerType::areInCorrectOrder | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | Apache-2.0 |
public static ContainerType[] getOrdered()
{
return new ContainerType[]{CONTENT_DESCRIPTION, CONTENT_BRANDING, EXTENDED_CONTENT, METADATA_OBJECT, METADATA_LIBRARY_OBJECT};
} |
Returns the elements in an order, that indicates more capabilities
(ascending).<br>
@return capability ordered types
| ContainerType::getOrdered | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | Apache-2.0 |
ContainerType(final GUID guid, final int maxDataLenBits, final boolean guidAllowed, final boolean stream, final boolean language, final boolean multiValue)
{
this.containerGUID = guid;
this.maximumDataLength = BigInteger.valueOf(2).pow(maxDataLenBits).subtract(BigInteger.ONE);
if (this.maximumDataLength.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) <= 0)
{
this.perfMaxDataLen = this.maximumDataLength.longValue();
}
else
{
this.perfMaxDataLen = -1;
}
this.guidEnabled = guidAllowed;
this.streamEnabled = stream;
this.languageEnabled = language;
this.multiValued = multiValue;
} |
Creates an instance
@param guid see {@link #containerGUID}
@param maxDataLenBits The amount of bits that is used to represent an unsigned value
for the containers size descriptors. Will create a maximum
value for {@link #maximumDataLength}. (2 ^ maxDataLenBits -1)
@param guidAllowed see {@link #guidEnabled}
@param stream see {@link #streamEnabled}
@param language see {@link #languageEnabled}
@param multiValue see {@link #multiValued}
| ContainerType::ContainerType | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | Apache-2.0 |
public void assertConstraints(final String name, final byte[] data, final int type, final int stream, final int language)
{
final RuntimeException result = checkConstraints(name, data, type, stream, language);
if (result != null)
{
throw result;
}
} |
Calls {@link #checkConstraints(String, byte[], int, int, int)} and
actually throws the exception if there is one.
@param name name of the descriptor
@param data content
@param type data type
@param stream stream number
@param language language index
| ContainerType::assertConstraints | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | Apache-2.0 |
public RuntimeException checkConstraints(final String name, final byte[] data, final int type, final int stream, final int language)
{
RuntimeException result = null;
// TODO generate tests
if (name == null || data == null)
{
result = new IllegalArgumentException("Arguments must not be null.");
}
else
{
if (!Utils.isStringLengthValidNullSafe(name))
{
result = new IllegalArgumentException(ErrorMessage.WMA_LENGTH_OF_STRING_IS_TOO_LARGE.getMsg(name.length()));
}
}
if (result == null && !isWithinValueRange(data.length))
{
result = new IllegalArgumentException(ErrorMessage.WMA_LENGTH_OF_DATA_IS_TOO_LARGE.getMsg(data.length, getMaximumDataLength(), getContainerGUID().getDescription()));
}
if (result == null && (stream < 0 || stream > MetadataDescriptor.MAX_STREAM_NUMBER || (!isStreamNumberEnabled() && stream != 0)))
{
final String streamAllowed = isStreamNumberEnabled() ? "0 to 127" : "0";
result = new IllegalArgumentException(ErrorMessage.WMA_INVALID_STREAM_REFERNCE.getMsg(stream, streamAllowed, getContainerGUID().getDescription()));
}
if (result == null && type == MetadataDescriptor.TYPE_GUID && !isGuidEnabled())
{
result = new IllegalArgumentException(ErrorMessage.WMA_INVALID_GUID_USE.getMsg(getContainerGUID().getDescription()));
}
if (result == null && ((language != 0 && !isLanguageEnabled()) || (language < 0 || language >= MetadataDescriptor.MAX_LANG_INDEX)))
{
final String langAllowed = isStreamNumberEnabled() ? "0 to 126" : "0";
result = new IllegalArgumentException(ErrorMessage.WMA_INVALID_LANGUAGE_USE.getMsg(language, getContainerGUID().getDescription(), langAllowed));
}
if (result == null && this == CONTENT_DESCRIPTION && type != MetadataDescriptor.TYPE_STRING)
{
result = new IllegalArgumentException(ErrorMessage.WMA_ONLY_STRING_IN_CD.getMsg());
}
return result;
} |
Checks if the values for a {@linkplain MetadataDescriptor content
descriptor} match the contraints of the container type, and returns a
{@link RuntimeException} if the requirements aren't met.
@param name name of the descriptor
@param data content
@param type data type
@param stream stream number
@param language language index
@return <code>null</code> if everything is fine.
| ContainerType::checkConstraints | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | Apache-2.0 |
public GUID getContainerGUID()
{
return this.containerGUID;
} |
@return the containerGUID
| ContainerType::getContainerGUID | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | Apache-2.0 |
public BigInteger getMaximumDataLength()
{
return this.maximumDataLength;
} |
@return the maximumDataLength
| ContainerType::getMaximumDataLength | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | Apache-2.0 |
public boolean isGuidEnabled()
{
return this.guidEnabled;
} |
@return the guidEnabled
| ContainerType::isGuidEnabled | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | Apache-2.0 |
public boolean isLanguageEnabled()
{
return this.languageEnabled;
} |
@return the languageEnabled
| ContainerType::isLanguageEnabled | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | Apache-2.0 |
public boolean isWithinValueRange(final long value)
{
return (this.perfMaxDataLen == -1 || this.perfMaxDataLen >= value) && value >= 0;
} |
Tests if the given value is less than or equal to
{@link #getMaximumDataLength()}, and greater or equal to zero.<br>
@param value The value to test
@return <code>true</code> if size restrictions for binary data are met
with this container type.
| ContainerType::isWithinValueRange | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | Apache-2.0 |
public boolean isMultiValued()
{
return this.multiValued;
} |
@return the multiValued
| ContainerType::isMultiValued | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | Apache-2.0 |
public boolean isStreamNumberEnabled()
{
return this.streamEnabled;
} |
@return the streamEnabled
| ContainerType::isStreamNumberEnabled | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/ContainerType.java | Apache-2.0 |
public static MetadataContainerFactory getInstance()
{
return INSTANCE;
} |
Returns an instance.
@return an instance.
| MetadataContainerFactory::getInstance | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainerFactory.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainerFactory.java | Apache-2.0 |
private MetadataContainerFactory()
{
// Hidden
} |
Hidden utility class constructor.
| MetadataContainerFactory::MetadataContainerFactory | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainerFactory.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainerFactory.java | Apache-2.0 |
public MetadataContainer createContainer(final ContainerType type)
{
return createContainer(type, 0, BigInteger.ZERO);
} |
Creates an appropriate {@linkplain MetadataContainer container
implementation} for the given container type.
@param type the type of container to get a container instance for.
@return appropriate container implementation.
| MetadataContainerFactory::createContainer | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainerFactory.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainerFactory.java | Apache-2.0 |
public MetadataContainer createContainer(final ContainerType type, final long pos, final BigInteger chunkSize)
{
MetadataContainer result;
if (type == ContainerType.CONTENT_DESCRIPTION)
{
result = new ContentDescription(pos, chunkSize);
}
else if (type == ContainerType.CONTENT_BRANDING)
{
result = new ContentBranding(pos, chunkSize);
}
else
{
result = new MetadataContainer(type, pos, chunkSize);
}
return result;
} |
Convenience Method for I/O. Same as
{@link #createContainer(ContainerType)}, but additionally assigns
position and size. (since a {@link MetadataContainer} is actually a
{@link Chunk}).
@param type The containers type.
@param pos the position within the stream.
@param chunkSize the size of the container.
@return an appropriate container implementation with assigned size and
position.
| MetadataContainerFactory::createContainer | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainerFactory.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainerFactory.java | Apache-2.0 |
public MetadataContainer[] createContainers(final ContainerType[] types)
{
assert types != null;
final MetadataContainer[] result = new MetadataContainer[types.length];
for (int i = 0; i < result.length; i++)
{
result[i] = createContainer(types[i]);
}
return result;
} |
Convenience method which calls {@link #createContainer(ContainerType)}
for each given container type.
@param types types of the container which are to be created.
@return appropriate container implementations.
| MetadataContainerFactory::createContainers | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainerFactory.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/asf/data/MetadataContainerFactory.java | Apache-2.0 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.