-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathID3v2WWWFrameData.java
More file actions
59 lines (47 loc) · 1.23 KB
/
Copy pathID3v2WWWFrameData.java
File metadata and controls
59 lines (47 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package Mp3File;
import java.io.UnsupportedEncodingException;
public class ID3v2WWWFrameData extends AbstractID3v2FrameData {
protected String url;
public ID3v2WWWFrameData(boolean unsynchronisation) {
super(unsynchronisation);
}
public ID3v2WWWFrameData(boolean unsynchronisation, String url) {
super(unsynchronisation);
this.url = url;
}
public ID3v2WWWFrameData(boolean unsynchronisation, byte[] bytes) throws InvalidDataException {
super(unsynchronisation);
synchroniseAndUnpackFrameData(bytes);
}
@Override
protected void unpackFrameData(byte[] bytes) throws InvalidDataException {
try {
url = BufferTools.byteBufferToString(bytes, 0, bytes.length);
} catch (UnsupportedEncodingException e) {
url = "";
}
}
@Override
protected byte[] packFrameData() {
byte[] bytes = new byte[getLength()];
if (url != null && url.length() > 0) {
try {
BufferTools.stringIntoByteBuffer(url, 0, url.length(), bytes, 0);
} catch (UnsupportedEncodingException e) {
}
}
return bytes;
}
@Override
protected int getLength() {
int length = 0;
if (url != null) length = url.length();
return length;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}