@Override protected int getLength() { int length = 1; if (text != null) length += text.toBytes(true, false).length; return length; }
public byte[] toBytes(boolean includeBom) { return toBytes(includeBom, false); }
public byte[] toBytes() { return toBytes(false, false); }
@Override protected int getLength() { int length = 1; if (description != null) length += description.toBytes(true, true).length; else length++; if (url != null) length += url.length(); return length; }
@Override protected int getLength() { int length = 3; if (mimeType != null) length += mimeType.length(); if (description != null) length += description.toBytes(true, true).length; else length++; if (imageData != null) length += imageData.length; return length; }
@Override protected byte[] packFrameData() { byte[] bytes = new byte[getLength()]; if (text != null) { bytes[0] = text.getTextEncoding(); byte[] textBytes = text.toBytes(true, false); if (textBytes.length > 0) { BufferTools.copyIntoByteBuffer(textBytes, 0, textBytes.length, bytes, 1); } } return bytes; }
@Override protected byte[] packFrameData() { byte[] bytes = new byte[getLength()]; if (description != null) bytes[0] = description.getTextEncoding(); else bytes[0] = 0; int mimeTypeLength = 0; if (mimeType != null && mimeType.length() > 0) { mimeTypeLength = mimeType.length(); try { BufferTools.stringIntoByteBuffer(mimeType, 0, mimeTypeLength, bytes, 1); } catch (UnsupportedEncodingException e) { } } int marker = mimeTypeLength + 1; bytes[marker++] = 0; bytes[marker++] = pictureType; if (description != null && description.toBytes().length > 0) { byte[] descriptionBytes = description.toBytes(true, true); BufferTools.copyIntoByteBuffer(descriptionBytes, 0, descriptionBytes.length, bytes, marker); marker += descriptionBytes.length; } else { bytes[marker++] = 0; } if (imageData != null && imageData.length > 0) { BufferTools.copyIntoByteBuffer(imageData, 0, imageData.length, bytes, marker); } return bytes; }
@Override protected byte[] packFrameData() { byte[] bytes = new byte[getLength()]; if (description != null) bytes[0] = description.getTextEncoding(); else bytes[0] = 0; int marker = 1; if (description != null) { byte[] descriptionBytes = description.toBytes(true, true); BufferTools.copyIntoByteBuffer(descriptionBytes, 0, descriptionBytes.length, bytes, marker); marker += descriptionBytes.length; } else { bytes[marker++] = 0; } if (url != null && url.length() > 0) { try { BufferTools.stringIntoByteBuffer(url, 0, url.length(), bytes, marker); } catch (UnsupportedEncodingException e) { } } return bytes; }
byte[] descriptionBytes = description.toBytes(true, true); BufferTools.copyIntoByteBuffer(descriptionBytes, 0, descriptionBytes.length, bytes, marker); marker += descriptionBytes.length; byte[] commentBytes = comment.toBytes(true, false); BufferTools.copyIntoByteBuffer(commentBytes, 0, commentBytes.length, bytes, marker);
@Override protected int getLength() { int length = 1; if (text != null) length += text.toBytes(true, false).length; return length; }
public byte[] toBytes(boolean includeBom) { return toBytes(includeBom, false); }
public byte[] toBytes() { return toBytes(false, false); }
@Override protected int getLength() { int length = 1; if (description != null) length += description.toBytes(true, true).length; else length++; if (url != null) length += url.length(); return length; }
@Override protected int getLength() { int length = 3; if (mimeType != null) length += mimeType.length(); if (description != null) length += description.toBytes(true, true).length; else length++; if (imageData != null) length += imageData.length; return length; }
@Override protected byte[] packFrameData() { byte[] bytes = new byte[getLength()]; if (text != null) { bytes[0] = text.getTextEncoding(); byte[] textBytes = text.toBytes(true, false); if (textBytes.length > 0) { BufferTools.copyIntoByteBuffer(textBytes, 0, textBytes.length, bytes, 1); } } return bytes; }
@Override protected byte[] packFrameData() { byte[] bytes = new byte[getLength()]; if (description != null) bytes[0] = description.getTextEncoding(); else bytes[0] = 0; int mimeTypeLength = 0; if (mimeType != null && mimeType.length() > 0) { mimeTypeLength = mimeType.length(); try { BufferTools.stringIntoByteBuffer(mimeType, 0, mimeTypeLength, bytes, 1); } catch (UnsupportedEncodingException e) { } } int marker = mimeTypeLength + 1; bytes[marker++] = 0; bytes[marker++] = pictureType; if (description != null && description.toBytes().length > 0) { byte[] descriptionBytes = description.toBytes(true, true); BufferTools.copyIntoByteBuffer(descriptionBytes, 0, descriptionBytes.length, bytes, marker); marker += descriptionBytes.length; } else { bytes[marker++] = 0; } if (imageData != null && imageData.length > 0) { BufferTools.copyIntoByteBuffer(imageData, 0, imageData.length, bytes, marker); } return bytes; }
@Override protected byte[] packFrameData() { byte[] bytes = new byte[getLength()]; if (description != null) bytes[0] = description.getTextEncoding(); else bytes[0] = 0; int marker = 1; if (description != null) { byte[] descriptionBytes = description.toBytes(true, true); BufferTools.copyIntoByteBuffer(descriptionBytes, 0, descriptionBytes.length, bytes, marker); marker += descriptionBytes.length; } else { bytes[marker++] = 0; } if (url != null && url.length() > 0) { try { BufferTools.stringIntoByteBuffer(url, 0, url.length(), bytes, marker); } catch (UnsupportedEncodingException e) { } } return bytes; }
private void updateCustomTag() { byte[] existingCustomTag = mp3file.getCustomTag(); byte[] newCustomTag = null; if (keepCustomTag && existingCustomTag != null && existingCustomTag.length > 0) { if (customTag != null && customTag.length() > 0) { EncodedText customTagEncodedText = new EncodedText(customTag); byte bytes[] = customTagEncodedText.toBytes(true); int newLength = existingCustomTag.length + bytes.length; newCustomTag = new byte[newLength]; BufferTools.copyIntoByteBuffer(existingCustomTag, 0, existingCustomTag.length, newCustomTag, 0); BufferTools.copyIntoByteBuffer(bytes, 0, bytes.length, newCustomTag, existingCustomTag.length); } else { newCustomTag = mp3file.getCustomTag(); } } else if (customTag != null && customTag.length() > 0) { EncodedText customTagEncodedText = new EncodedText(customTag); newCustomTag = customTagEncodedText.toBytes(true); } mp3file.setCustomTag(newCustomTag); }