public ID3v2CommentFrameData(boolean unsynchronisation, String language, EncodedText description, EncodedText comment) { super(unsynchronisation); if (description != null && comment != null && description.getTextEncoding() != comment.getTextEncoding()) { throw new IllegalArgumentException("description and comment must have same text encoding"); } this.language = language; this.description = description; this.comment = comment; }
@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 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; }
@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 (comment != null) bytes[0] = comment.getTextEncoding(); else bytes[0] = 0; String langPadded;
public ID3v2CommentFrameData(boolean unsynchronisation, String language, EncodedText description, EncodedText comment) { super(unsynchronisation); if (description != null && comment != null && description.getTextEncoding() != comment.getTextEncoding()) { throw new IllegalArgumentException("description and comment must have same text encoding"); } this.language = language; this.description = description; this.comment = comment; }
@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 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; }
@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 (comment != null) bytes[0] = comment.getTextEncoding(); else bytes[0] = 0; String langPadded;