-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUString.java
More file actions
38 lines (29 loc) · 847 Bytes
/
Copy pathUString.java
File metadata and controls
38 lines (29 loc) · 847 Bytes
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
package model;
import java.io.IOException;
import java.io.InputStream;
public class UString extends Unsigned {
// 字节数组的字符串的长度
private int length;
// 字节数组的字符串
private String value;
public int getLength() {
return length;
}
public String getValue() {
return value;
}
protected void newBytes() {
this.bytes = new byte[this.length];
}
public static UString create(InputStream is, int length) throws IOException {
UString ustring = new UString();
ustring.length = length;
ustring.newBytes();
ustring.read(is, ustring.bytes);
ustring.value = new String(ustring.bytes);
return ustring;
}
public String toString() {
return value + "(" + parseBytesToHexString() + ")";
}
}