502 seedStream = java.security.AccessController.doPrivileged |
502 seedStream = java.security.AccessController.doPrivileged |
503 (new java.security.PrivilegedExceptionAction<InputStream>() { |
503 (new java.security.PrivilegedExceptionAction<InputStream>() { |
504 @Override |
504 @Override |
505 public InputStream run() throws IOException { |
505 public InputStream run() throws IOException { |
506 /* |
506 /* |
507 * return a FileInputStream for file URLs and |
507 * return a shared InputStream for file URLs and |
508 * avoid buffering. The openStream() call wraps |
508 * avoid buffering. |
509 * InputStream in a BufferedInputStream which |
509 * The URL.openStream() call wraps InputStream in a |
|
510 * BufferedInputStream which |
510 * can buffer up to 8K bytes. This read is a |
511 * can buffer up to 8K bytes. This read is a |
511 * performance issue for entropy sources which |
512 * performance issue for entropy sources which |
512 * can be slow to replenish. |
513 * can be slow to replenish. |
513 */ |
514 */ |
514 if (device.getProtocol().equalsIgnoreCase("file")) { |
515 if (device.getProtocol().equalsIgnoreCase("file")) { |
515 File deviceFile = |
516 File deviceFile = |
516 SunEntries.getDeviceFile(device); |
517 SunEntries.getDeviceFile(device); |
517 return new FileInputStream(deviceFile); |
518 return FileInputStreamPool |
|
519 .getInputStream(deviceFile); |
518 } else { |
520 } else { |
519 return device.openStream(); |
521 return device.openStream(); |
520 } |
522 } |
521 } |
523 } |
522 }); |
524 }); |