147 |
* Creates an InputStreamReader that uses a decoder of the given |
* Creates an InputStreamReader that uses a decoder of the given |
148 |
* charset to decode the bytes in the InputStream into |
* charset to decode the bytes in the InputStream into |
149 |
* characters. |
* characters. |
150 |
|
* @since 1.4 |
151 |
*/ |
*/ |
152 |
public InputStreamReader(InputStream in, Charset charset) { |
public InputStreamReader(InputStream in, Charset charset) |
153 |
|
{ |
154 |
/* FIXME: InputStream is wrapped in Channel which is read by a |
/* FIXME: InputStream is wrapped in Channel which is read by a |
155 |
* Reader-implementation for channels. However to fix this we |
* Reader-implementation for channels. However to fix this we |
156 |
* need to completely move to NIO-style character |
* need to completely move to NIO-style character |
157 |
* encoding/decoding. |
* encoding/decoding. |
158 |
*/ |
*/ |
159 |
this.in = Channels.newReader(Channels.newChannel(in), charset.newDecoder(), -1); |
this.in = Channels.newReader(Channels.newChannel(in), charset.newDecoder(), |
160 |
|
-1); |
161 |
encoding = charset.name(); |
encoding = charset.name(); |
162 |
} |
} |
163 |
|
|
164 |
/** |
/** |
165 |
* Creates an InputStreamReader that uses the given charset decoder |
* Creates an InputStreamReader that uses the given charset decoder |
166 |
* to decode the bytes in the InputStream into characters. |
* to decode the bytes in the InputStream into characters. |
167 |
|
* @since 1.4 |
168 |
*/ |
*/ |
169 |
public InputStreamReader(InputStream in, CharsetDecoder decoder) { |
public InputStreamReader(InputStream in, CharsetDecoder decoder) |
170 |
|
{ |
171 |
// FIXME: see {@link InputStreamReader(InputStream, Charset) |
// FIXME: see {@link InputStreamReader(InputStream, Charset) |
172 |
this.in = Channels.newReader(Channels.newChannel(in), decoder, -1); |
this.in = Channels.newReader(Channels.newChannel(in), decoder, -1); |
|
|
|
173 |
encoding = decoder.charset().name(); |
encoding = decoder.charset().name(); |
174 |
} |
} |
175 |
|
|