equal
deleted
inserted
replaced
26 package sun.security.util; |
26 package sun.security.util; |
27 |
27 |
28 import java.io.*; |
28 import java.io.*; |
29 import java.math.BigInteger; |
29 import java.math.BigInteger; |
30 import java.util.Date; |
30 import java.util.Date; |
|
31 import sun.misc.IOUtils; |
31 |
32 |
32 /** |
33 /** |
33 * Represents a single DER-encoded value. DER encoding rules are a subset |
34 * Represents a single DER-encoded value. DER encoding rules are a subset |
34 * of the "Basic" Encoding Rules (BER), but they only support a single way |
35 * of the "Basic" Encoding Rules (BER), but they only support a single way |
35 * ("Definite" encoding) to encode any given value. |
36 * ("Definite" encoding) to encode any given value. |
380 } |
381 } |
381 |
382 |
382 if (fullyBuffered && in.available() != length) |
383 if (fullyBuffered && in.available() != length) |
383 throw new IOException("extra data given to DerValue constructor"); |
384 throw new IOException("extra data given to DerValue constructor"); |
384 |
385 |
385 byte[] bytes = new byte[length]; |
386 byte[] bytes = IOUtils.readFully(in, length, true); |
386 |
387 |
387 // n.b. readFully not needed in normal fullyBuffered case |
|
388 DataInputStream dis = new DataInputStream(in); |
|
389 |
|
390 dis.readFully(bytes); |
|
391 buffer = new DerInputBuffer(bytes); |
388 buffer = new DerInputBuffer(bytes); |
392 return new DerInputStream(buffer); |
389 return new DerInputStream(buffer); |
393 } |
390 } |
394 |
391 |
395 /** |
392 /** |