377 len = DerInputStream.getDefiniteLength(buffer);
378 }
379
380 if (len == 0)
381 // return empty array instead of null, which should be
382 // used only for missing optionals
383 return new DerValue[0];
384
385 /*
386 * Create a temporary stream from which to read the data,
387 * unless it's not really needed.
388 */
389 if (buffer.available() == len)
390 newstr = this;
391 else
392 newstr = subStream(len, true);
393
394 /*
395 * Pull values out of the stream.
396 */
397 Vector<DerValue> vec = new Vector<DerValue>(startLen);
398 DerValue value;
399
400 do {
401 value = new DerValue(newstr.buffer);
402 vec.addElement(value);
403 } while (newstr.available() > 0);
404
405 if (newstr.available() != 0)
406 throw new IOException("extra data at end of vector");
407
408 /*
409 * Now stick them into the array we're returning.
410 */
411 int i, max = vec.size();
412 DerValue[] retval = new DerValue[max];
413
414 for (i = 0; i < max; i++)
415 retval[i] = vec.elementAt(i);
416
417 return retval;
|
377 len = DerInputStream.getDefiniteLength(buffer);
378 }
379
380 if (len == 0)
381 // return empty array instead of null, which should be
382 // used only for missing optionals
383 return new DerValue[0];
384
385 /*
386 * Create a temporary stream from which to read the data,
387 * unless it's not really needed.
388 */
389 if (buffer.available() == len)
390 newstr = this;
391 else
392 newstr = subStream(len, true);
393
394 /*
395 * Pull values out of the stream.
396 */
397 Vector<DerValue> vec = new Vector<>(startLen);
398 DerValue value;
399
400 do {
401 value = new DerValue(newstr.buffer);
402 vec.addElement(value);
403 } while (newstr.available() > 0);
404
405 if (newstr.available() != 0)
406 throw new IOException("extra data at end of vector");
407
408 /*
409 * Now stick them into the array we're returning.
410 */
411 int i, max = vec.size();
412 DerValue[] retval = new DerValue[max];
413
414 for (i = 0; i < max; i++)
415 retval[i] = vec.elementAt(i);
416
417 return retval;
|