public static String byteBufferToStringIgnoringEncodingIssues(byte[] bytes, int offset, int length) { try { return byteBufferToString(bytes, offset, length, defaultCharsetName); } catch (UnsupportedEncodingException e) { return null; } }
@Override protected void unpackFrameData(byte[] bytes) throws InvalidDataException { try { url = BufferTools.byteBufferToString(bytes, 0, bytes.length); } catch (UnsupportedEncodingException e) { url = ""; } }
public static String byteBufferToString(byte[] bytes, int offset, int length) throws UnsupportedEncodingException { return byteBufferToString(bytes, offset, length, defaultCharsetName); }
@Override protected void unpackFrameData(byte[] bytes) throws InvalidDataException { try { address = BufferTools.byteBufferToString(bytes, 0, bytes.length - 2); } catch (UnsupportedEncodingException e) { address = ""; } final byte ratingByte = bytes[bytes.length - 1]; if (byteToRating.containsKey(ratingByte)) { rating = byteToRating.get(ratingByte); } else { rating = -1; } }
@Override protected void unpackFrameData(byte[] bytes) throws InvalidDataException { int marker = BufferTools.indexOfTerminatorForEncoding(bytes, 1, bytes[0]); if (marker >= 0) { description = new EncodedText(bytes[0], BufferTools.copyBuffer(bytes, 1, marker - 1)); marker += description.getTerminator().length; } else { description = new EncodedText(bytes[0], ""); marker = 1; } try { url = BufferTools.byteBufferToString(bytes, marker, bytes.length - marker); } catch (UnsupportedEncodingException e) { url = ""; } }
@Override protected void unpackFrameData(byte[] bytes) throws InvalidDataException { String filetype; try { filetype = BufferTools.byteBufferToString(bytes, 1, 3); } catch (UnsupportedEncodingException e) { filetype = "unknown"; } mimeType = "image/" + filetype.toLowerCase(); pictureType = bytes[4]; int marker = BufferTools.indexOfTerminatorForEncoding(bytes, 5, bytes[0]); if (marker >= 0) { description = new EncodedText(bytes[0], BufferTools.copyBuffer(bytes, 5, marker - 5)); marker += description.getTerminator().length; } else { description = new EncodedText(bytes[0], ""); marker = 1; } imageData = BufferTools.copyBuffer(bytes, marker, bytes.length - marker); } }
@Override protected void unpackFrameData(byte[] bytes) throws InvalidDataException { try { language = BufferTools.byteBufferToString(bytes, 1, 3); } catch (UnsupportedEncodingException e) { language = ""; } int marker = BufferTools.indexOfTerminatorForEncoding(bytes, 4, bytes[0]); if (marker >= 4) { description = new EncodedText(bytes[0], BufferTools.copyBuffer(bytes, 4, marker - 4)); marker += description.getTerminator().length; } else { description = new EncodedText(bytes[0], ""); marker = 4; } comment = new EncodedText(bytes[0], BufferTools.copyBuffer(bytes, marker, bytes.length - marker)); }
public static String byteBufferToStringIgnoringEncodingIssues(byte[] bytes, int offset, int length) { try { return byteBufferToString(bytes, offset, length, defaultCharsetName); } catch (UnsupportedEncodingException e) { return null; } }
@Override protected void unpackFrameData(byte[] bytes) throws InvalidDataException { int marker = BufferTools.indexOfTerminator(bytes, 1, 1); if (marker >= 0) { try { mimeType = BufferTools.byteBufferToString(bytes, 1, marker - 1); } catch (UnsupportedEncodingException e) { mimeType = "image/unknown"; } } else { mimeType = "image/unknown"; } pictureType = bytes[marker + 1]; marker += 2; int marker2 = BufferTools.indexOfTerminatorForEncoding(bytes, marker, bytes[0]); if (marker2 >= 0) { description = new EncodedText(bytes[0], BufferTools.copyBuffer(bytes, marker, marker2 - marker)); marker2 += description.getTerminator().length; } else { description = new EncodedText(bytes[0], ""); marker2 = marker; } imageData = BufferTools.copyBuffer(bytes, marker2, bytes.length - marker2); }
@Override protected void unpackFrameData(byte[] bytes) throws InvalidDataException { try { url = BufferTools.byteBufferToString(bytes, 0, bytes.length); } catch (UnsupportedEncodingException e) { url = ""; } }
public static String byteBufferToString(byte[] bytes, int offset, int length) throws UnsupportedEncodingException { return byteBufferToString(bytes, offset, length, defaultCharsetName); }
@Override protected void unpackFrameData(byte[] bytes) throws InvalidDataException { try { address = BufferTools.byteBufferToString(bytes, 0, bytes.length - 2); } catch (UnsupportedEncodingException e) { address = ""; } final byte ratingByte = bytes[bytes.length - 1]; if (byteToRating.containsKey(ratingByte)) { rating = byteToRating.get(ratingByte); } else { rating = -1; } }
private void showCustomTag(StringBuffer buffer) { buffer.append("Custom Tag\n"); byte[] bytes = mp3file.getCustomTag(); if (bytes == null) { buffer.append(" NONE!\n"); } else { int length = Math.min(bytes.length, MAX_CUSTOM_TAG_BYTES_TO_SHOW); try { String s = BufferTools.byteBufferToString(bytes, 0, length); showLastField(buffer, "Data", BufferTools.asciiOnly(s), bytes.length > MAX_CUSTOM_TAG_BYTES_TO_SHOW ? "..." : null); } catch (UnsupportedEncodingException e) { buffer.append(" ?\n"); } } }
private void catalogCustomTag(StringBuffer cat) { byte[] bytes = mp3file.getCustomTag(); if (bytes == null) { catalogLastField(cat, ""); } else { int length = Math.min(bytes.length, MAX_CUSTOM_TAG_BYTES_TO_SHOW); try { String s = BufferTools.byteBufferToString(bytes, 0, length); catalogLastField(cat, BufferTools.asciiOnly(s)); } catch (UnsupportedEncodingException e) { catalogLastField(cat, ""); } } }
@Override protected void unpackFrameData(byte[] bytes) throws InvalidDataException { int marker = BufferTools.indexOfTerminatorForEncoding(bytes, 1, bytes[0]); if (marker >= 0) { description = new EncodedText(bytes[0], BufferTools.copyBuffer(bytes, 1, marker - 1)); marker += description.getTerminator().length; } else { description = new EncodedText(bytes[0], ""); marker = 1; } try { url = BufferTools.byteBufferToString(bytes, marker, bytes.length - marker); } catch (UnsupportedEncodingException e) { url = ""; } }
@Override protected void unpackFrameData(byte[] bytes) throws InvalidDataException { String filetype; try { filetype = BufferTools.byteBufferToString(bytes, 1, 3); } catch (UnsupportedEncodingException e) { filetype = "unknown"; } mimeType = "image/" + filetype.toLowerCase(); pictureType = bytes[4]; int marker = BufferTools.indexOfTerminatorForEncoding(bytes, 5, bytes[0]); if (marker >= 0) { description = new EncodedText(bytes[0], BufferTools.copyBuffer(bytes, 5, marker - 5)); marker += description.getTerminator().length; } else { description = new EncodedText(bytes[0], ""); marker = 1; } imageData = BufferTools.copyBuffer(bytes, marker, bytes.length - marker); } }
@Override protected void unpackFrameData(byte[] bytes) throws InvalidDataException { try { language = BufferTools.byteBufferToString(bytes, 1, 3); } catch (UnsupportedEncodingException e) { language = ""; } int marker = BufferTools.indexOfTerminatorForEncoding(bytes, 4, bytes[0]); if (marker >= 4) { description = new EncodedText(bytes[0], BufferTools.copyBuffer(bytes, 4, marker - 4)); marker += description.getTerminator().length; } else { description = new EncodedText(bytes[0], ""); marker = 4; } comment = new EncodedText(bytes[0], BufferTools.copyBuffer(bytes, marker, bytes.length - marker)); }
@Override protected void unpackFrameData(byte[] bytes) throws InvalidDataException { int marker = BufferTools.indexOfTerminator(bytes, 1, 1); if (marker >= 0) { try { mimeType = BufferTools.byteBufferToString(bytes, 1, marker - 1); } catch (UnsupportedEncodingException e) { mimeType = "image/unknown"; } } else { mimeType = "image/unknown"; } pictureType = bytes[marker + 1]; marker += 2; int marker2 = BufferTools.indexOfTerminatorForEncoding(bytes, marker, bytes[0]); if (marker2 >= 0) { description = new EncodedText(bytes[0], BufferTools.copyBuffer(bytes, marker, marker2 - marker)); marker2 += description.getTerminator().length; } else { description = new EncodedText(bytes[0], ""); marker2 = marker; } imageData = BufferTools.copyBuffer(bytes, marker2, bytes.length - marker2); }