Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ public class InputStreamReader extends Reader {
* @param in An InputStream
*/
public InputStreamReader(InputStream in) {
super(in);
sd = StreamDecoder.forInputStreamReader(in, this,
sd = StreamDecoder.forInputStreamReader(in, this.lock,
Charset.defaultCharset()); // ## check lock object
}

Expand All @@ -90,10 +89,9 @@ public InputStreamReader(InputStream in) {
public InputStreamReader(InputStream in, String charsetName)
throws UnsupportedEncodingException
{
super(in);
if (charsetName == null)
throw new NullPointerException("charsetName");
sd = StreamDecoder.forInputStreamReader(in, this, charsetName);
sd = StreamDecoder.forInputStreamReader(in, this.lock, charsetName);
}

/**
Expand All @@ -106,10 +104,9 @@ public InputStreamReader(InputStream in, String charsetName)
* @spec JSR-51
*/
public InputStreamReader(InputStream in, Charset cs) {
super(in);
if (cs == null)
throw new NullPointerException("charset");
sd = StreamDecoder.forInputStreamReader(in, this, cs);
sd = StreamDecoder.forInputStreamReader(in, this.lock, cs);
}

/**
Expand All @@ -122,10 +119,9 @@ public InputStreamReader(InputStream in, Charset cs) {
* @spec JSR-51
*/
public InputStreamReader(InputStream in, CharsetDecoder dec) {
super(in);
if (dec == null)
throw new NullPointerException("charset decoder");
sd = StreamDecoder.forInputStreamReader(in, this, dec);
sd = StreamDecoder.forInputStreamReader(in, this.lock, dec);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public OutputStreamWriter(OutputStream out, String charsetName)
super(out);
if (charsetName == null)
throw new NullPointerException("charsetName");
se = StreamEncoder.forOutputStreamWriter(out, this, charsetName);
se = StreamEncoder.forOutputStreamWriter(out, this.lock, charsetName);
}

/**
Expand All @@ -108,7 +108,7 @@ public OutputStreamWriter(OutputStream out, String charsetName)
public OutputStreamWriter(OutputStream out) {
super(out);
try {
se = StreamEncoder.forOutputStreamWriter(out, this, (String)null);
se = StreamEncoder.forOutputStreamWriter(out, this.lock, (String)null);
} catch (UnsupportedEncodingException e) {
throw new Error(e);
}
Expand All @@ -130,7 +130,7 @@ public OutputStreamWriter(OutputStream out, Charset cs) {
super(out);
if (cs == null)
throw new NullPointerException("charset");
se = StreamEncoder.forOutputStreamWriter(out, this, cs);
se = StreamEncoder.forOutputStreamWriter(out, this.lock, cs);
}

/**
Expand All @@ -149,7 +149,7 @@ public OutputStreamWriter(OutputStream out, CharsetEncoder enc) {
super(out);
if (enc == null)
throw new NullPointerException("charset encoder");
se = StreamEncoder.forOutputStreamWriter(out, this, enc);
se = StreamEncoder.forOutputStreamWriter(out, this.lock, enc);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,14 @@ private static FileChannel getChannel(FileInputStream in) {
private InputStream in;
private ReadableByteChannel ch;

StreamDecoder(InputStream in, Object lock, Charset cs) {
private StreamDecoder(InputStream in, Object lock, Charset cs) {
this(in, lock,
cs.newDecoder()
.onMalformedInput(CodingErrorAction.REPLACE)
.onUnmappableCharacter(CodingErrorAction.REPLACE));
}

StreamDecoder(InputStream in, Object lock, CharsetDecoder dec) {
private StreamDecoder(InputStream in, Object lock, CharsetDecoder dec) {
super(lock);
this.cs = dec.charset();
this.decoder = dec;
Expand All @@ -260,7 +260,7 @@ private static FileChannel getChannel(FileInputStream in) {
bb.flip(); // So that bb is initially empty
}

StreamDecoder(ReadableByteChannel ch, CharsetDecoder dec, int mbc) {
private StreamDecoder(ReadableByteChannel ch, CharsetDecoder dec, int mbc) {
this.in = null;
this.ch = ch;
this.decoder = dec;
Expand Down