Id3Decoder implements MetadataDecoder { private static UrlLinkFrame decodeUrlLinkFrame(ParsableByteArray id3Data, int frameSize, String id) throws UnsupportedEncodingException { byte[] data = new byte[frameSize]; id3Data.readBytes(data, 0, frameSize); int urlEndIndex = indexOfZeroByte(data, 0); String url = new String(data, 0, urlEndIndex, "ISO-8859-1"); return new UrlLinkFrame(id, null, url); } Id3Decoder();  Id3Decoder(@Nullable FramePredicate framePredicate); @SuppressWarnings("ByteBufferBackingArray") @Override @Nullable Metadata decode(MetadataInputBuffer inputBuffer); @Nullable Metadata decode(byte[] data, int size); static final FramePredicate NO_FRAMES_PREDICATE; static final int ID3_TAG; static final int ID3_HEADER_LENGTH; }
@Test public void testDecodeUrlLinkFrame() { byte[] rawId3 = buildSingleFrameTag("WCOM", new byte[] {104, 116, 116, 112, 115, 58, 47, 47, 116, 101, 115, 116, 46, 99, 111, 109, 47, 97, 98, 99, 63, 100, 101, 102}); Id3Decoder decoder = new Id3Decoder(); Metadata metadata = decoder.decode(rawId3, rawId3.length); assertThat(metadata.length()).isEqualTo(1); UrlLinkFrame urlLinkFrame = (UrlLinkFrame) metadata.get(0); assertThat(urlLinkFrame.id).isEqualTo("WCOM"); assertThat(urlLinkFrame.description).isNull(); assertThat(urlLinkFrame.url).isEqualTo("https: rawId3 = buildSingleFrameTag("WCOM", new byte[0]); metadata = decoder.decode(rawId3, rawId3.length); assertThat(metadata.length()).isEqualTo(1); urlLinkFrame = (UrlLinkFrame) metadata.get(0); assertThat(urlLinkFrame.id).isEqualTo("WCOM"); assertThat(urlLinkFrame.description).isNull(); assertThat(urlLinkFrame.url).isEmpty(); }