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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/java.base/share/classes/jdk/internal/jmod/JmodFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

package jdk.internal.jmod;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
Expand All @@ -52,11 +51,10 @@ 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);
in.read(magic);
stsypanov marked this conversation as resolved.
Show resolved Hide resolved
if (magic[0] != JMOD_MAGIC_NUMBER[0] ||
magic[1] != JMOD_MAGIC_NUMBER[1]) {
throw new IOException("Invalid JMOD file: " + file.toString());
Expand Down
3 changes: 1 addition & 2 deletions src/java.base/share/classes/sun/net/www/http/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,7 @@ protected boolean available() {
try {
old = serverSocket.getSoTimeout();
serverSocket.setSoTimeout(1);
BufferedInputStream tmpbuf =
new BufferedInputStream(serverSocket.getInputStream());
InputStream tmpbuf = serverSocket.getInputStream();
int r = tmpbuf.read();
if (r == -1) {
logFinest("HttpClient.available(): " +
stsypanov marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

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

public class ByteArrayImageSource extends InputStreamImageSource {
byte[] imagedata;
Expand All @@ -52,10 +51,7 @@ 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);
stsypanov marked this conversation as resolved.
Show resolved Hide resolved
return getDecoder(is);
}
}