< prev index next >
src/java.base/share/classes/java/lang/module/ModuleReader.java
Print this page
rev 14279 : [mq]: 8140281-deprecation-optional.get
*** 100,110 ****
* If denied by the security manager
*/
default Optional<InputStream> open(String name) throws IOException {
Optional<URI> ouri = find(name);
if (ouri.isPresent()) {
! return Optional.of(ouri.get().toURL().openStream());
} else {
return Optional.empty();
}
}
--- 100,110 ----
* If denied by the security manager
*/
default Optional<InputStream> open(String name) throws IOException {
Optional<URI> ouri = find(name);
if (ouri.isPresent()) {
! return Optional.of(ouri.getWhenPresent().toURL().openStream());
} else {
return Optional.empty();
}
}
*** 142,152 ****
* @see ClassLoader#defineClass(String, ByteBuffer, java.security.ProtectionDomain)
*/
default Optional<ByteBuffer> read(String name) throws IOException {
Optional<InputStream> in = open(name);
if (in.isPresent()) {
! byte[] bytes = in.get().readAllBytes();
return Optional.of(ByteBuffer.wrap(bytes));
} else {
return Optional.empty();
}
}
--- 142,152 ----
* @see ClassLoader#defineClass(String, ByteBuffer, java.security.ProtectionDomain)
*/
default Optional<ByteBuffer> read(String name) throws IOException {
Optional<InputStream> in = open(name);
if (in.isPresent()) {
! byte[] bytes = in.getWhenPresent().readAllBytes();
return Optional.of(ByteBuffer.wrap(bytes));
} else {
return Optional.empty();
}
}
< prev index next >