Home | History | Annotate | Download | only in aware

Lines Matching refs:length

33  * Type/Length/Value format. The utilities accept a configuration of the size of
34 * the Type field and the Length field. A Type field size of 0 is allowed -
46 * Type/Length/Value.
48 * A constructor is created specifying the size of the Type (T) and Length
71 * Length (L) fields.
77 * @param lengthSize Number of bytes used for the Length (L) field.
98 mArrayLength = (array == null) ? 0 : array.length;
116 * Creates a TLV array (of the previously specified Type and Length sizes) from the input
117 * list. Allocates an array matching the contents (and required Type and Length
118 * fields), copies the contents, and set the Length fields. The Type field is set to 0.
129 size += field.length;
165 * @param length Copy the specified number (length) of bytes from the
171 int length) {
172 checkLength(length);
173 addHeader(type, length);
174 if (length != 0) {
175 System.arraycopy(array, offset, mArray, mPosition, length);
177 mPosition += length;
192 return putByteArray(type, array, 0, (array == null) ? 0 : array.length);
196 * Places a zero length element (i.e. Length field = 0) into the TLV.
261 int length = 0;
264 length = bytes.length;
266 return putByteArray(type, bytes, 0, length);
297 private void addHeader(int type, int length) {
306 mArray[mPosition] = (byte) length;
308 Memory.pokeShort(mArray, mPosition, (short) length, ByteOrder.BIG_ENDIAN);
328 * The Length (L) field of the current TLV element.
330 public int length;
344 private TlvElement(int type, int length, @Nullable byte[] refArray, int offset) {
346 this.length = length;
350 if (offset + length > refArray.length) {
357 * length 1. Note: an attempt to call this function on a TLV item whose
358 * {@link TlvElement#length} is != 1 will result in an exception.
363 if (length != 1) {
365 "Accesing a byte from a TLV element of length " + length);
372 * length 2. Note: an attempt to call this function on a TLV item whose
373 * {@link TlvElement#length} is != 2 will result in an exception.
378 if (length != 2) {
380 "Accesing a short from a TLV element of length " + length);
387 * of length 4. Note: an attempt to call this function on a TLV item
388 * whose {@link TlvElement#length} is != 4 will result in an exception.
393 if (length != 4) {
395 "Accesing an int from a TLV element of length " + length);
406 return new String(refArray, offset, length);
421 * (the sizes of the Type and Length fields), and the byte array whose
427 * @param lengthSize Number of bytes used for the Length (L) field.
439 mArrayLength = (array == null) ? 0 : array.length;
445 * fields whose length is 1, 2, or 4 respectively).
462 builder.append("L=" + tlv.length + ") ");
463 if (tlv.length == 0) {
465 } else if (tlv.length == 1) {
467 } else if (tlv.length == 2) {
469 } else if (tlv.length == 4) {
474 if (tlv.length != 0) {
489 list.add(Arrays.copyOfRange(tlv.refArray, tlv.offset, tlv.offset + tlv.length));
523 int length = 0;
525 length = mArray[mOffset];
527 length = Memory.peekShort(mArray, mOffset, ByteOrder.BIG_ENDIAN);
531 TlvElement tlv = new TlvElement(type, length, mArray, mOffset);
532 mOffset += length;
545 * Validates that a (T)LV array is constructed correctly. I.e. that its specified Length
546 * fields correctly fill the specified length (and do not overshoot).
550 * @param lengthSize The size (in bytes) of the length field. Valid values are 1 or 2.
567 while (nextTlvIndex + typeSize + lengthSize <= array.length) {
577 return nextTlvIndex == array.length;