Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8263560: Remove needless wrapping with BufferedInputStream #2992

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -25,7 +25,6 @@

package jdk.internal.jmod;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -52,11 +51,12 @@ public class JmodFile implements AutoCloseable {
};

public static void checkMagic(Path file) throws IOException {
try (InputStream in = Files.newInputStream(file);
BufferedInputStream bis = new BufferedInputStream(in)) {
try (InputStream in = Files.newInputStream(file)) {
// validate the header
byte[] magic = new byte[4];
bis.read(magic);
byte[] magic = in.readNBytes(4);
if (magic.length != 4) {
throw new IOException("Invalid JMOD file: " + file);
}
if (magic[0] != JMOD_MAGIC_NUMBER[0] ||
magic[1] != JMOD_MAGIC_NUMBER[1]) {
throw new IOException("Invalid JMOD file: " + file.toString());
@@ -27,7 +27,6 @@

import java.io.InputStream;
import java.io.ByteArrayInputStream;
import java.io.BufferedInputStream;

public class ByteArrayImageSource extends InputStreamImageSource {
byte[] imagedata;
@@ -52,10 +51,8 @@ final boolean checkSecurity(Object context, boolean quiet) {
}

protected ImageDecoder getDecoder() {
InputStream is =
new BufferedInputStream(new ByteArrayInputStream(imagedata,
imageoffset,
imagelength));
InputStream is = new ByteArrayInputStream(imagedata, imageoffset,
imagelength);
return getDecoder(is);
}
}