Home | History | Annotate | Download | only in gpac

Lines Matching refs:length

60         StringBuilder sb = new StringBuilder(digest.length * 2);
69 /** Decodes the byte array into BerTlv Object. Performs checks for length and tag */
74 /** Decodes the byte array into BerTlv Object. Performs checks for length and tag */
78 if (data == null || data.length == 0) {
86 if (curIndex < data.length) {
91 if (curIndex < data.length) {
95 "Index " + curIndex + " out of range! [0..[" + data.length);
104 throw new ParserException("Index " + curIndex + " out of range! [0..[" + data.length);
107 /* length */
108 int length;
109 if (curIndex < data.length) {
112 length = temp;
114 if (curIndex < data.length) {
115 length = data[curIndex++] & 0xff;
116 if (length < 0x80) {
117 throw new ParserException("Invalid TLV length encoding!");
119 if (containsAllData && data.length < length + curIndex) {
124 "Index " + curIndex + " out of range! [0..[" + data.length);
127 if ((curIndex + 1) < data.length) {
128 length = ((data[curIndex] & 0xff) << 8) | (data[curIndex + 1] & 0xff);
130 throw new ParserException("Index out of range! [0..[" + data.length);
133 if (length < 0x100) {
134 throw new ParserException("Invalid TLV length encoding!");
136 if (containsAllData && data.length < length + curIndex) {
140 if ((curIndex + 2) < data.length) {
141 length =
146 throw new ParserException("Index out of range! [0..[" + data.length);
149 if (length < 0x10000) {
150 throw new ParserException("Invalid TLV length encoding!");
152 if (containsAllData && data.length < length + curIndex) {
156 throw new ParserException("Unsupported TLV length encoding!");
159 throw new ParserException("Index " + curIndex + " out of range! [0..[" + data.length);
162 return new BerTlv(data, tag, curIndex, length);
166 * Encodes length according to ASN1. Supported are length values up to 3 bytes -> 83 xx yy zz.
168 public static void encodeLength(int length, ByteArrayOutputStream stream) {
170 if (length > 0x0000FFFF) {
172 stream.write(((length & 0x00FF0000) >> 16));
173 stream.write(((length & 0x0000FF00) >> 8));
174 stream.write((length & 0x000000FF));
175 } else if (length > 0x000000FF) {
177 stream.write(((length & 0x0000FF00) >> 8));
178 stream.write((length & 0x000000FF));
179 } else if (length > 0x0000007F) {
181 stream.write((length & 0x000000FF));
183 stream.write((length & 0x000000FF));
209 // write length
232 || mValueIndex > mRawData.length
233 || mValueIndex + mValueLength > mRawData.length) {