title: Java: Which are the implicit encodings used for Sytem.out/in/err, files?
body: <p>First task: I want to read from System.in into a reader.
  It seems that this is done via</p>
  <pre><code>InputStreamReader cin = new InputStreamReader(System.in);
  </code></pre>
  <p>Well there are other constructors including an encoding.
  It is not clear what there the default encoding is.
  As I understand, System.in is just a stream of bytes.
  Whereas InputStreamReader reads chars.
  But where does constructor of InputStream know the charset?
  Do i have to apply a specific charset? if so which one or do i have to leave it away?</p>
  <p>According question concerning System.out and System.err.
  Both seem to be print streams and in particular reading bytes.</p>
  <pre><code>OutputStreamWriter out  = new OutputStreamWriter(System.out);
  </code></pre>
  <p>ok choosing the right encoding or do i have to use a different constructor?</p>
  <p>What about System.err?</p>
  <p>Also what are the charsets????</p>
  <p>Same question i have for PipedReader/Writer.
  At least they must coincide, right?</p>
  <p>For StringWriter/Reader: same encoding as string, i.e. utf8, right?</p>
  <p>Last question concerning files.
  FileReader/Writer are subclasses of InputStreamReader/Writer.
  This seems reasonable, since files are a sequence of bytes.
  But unlike constructor of InputStreamReader/Writer,
  which have constructors with charsets, FileReader/Writer do not.
  how can they know the encoding of the file???</p>
  <p>Thanks for clarifying.</p>