原创

输出流

有哪些构造方法可以在参数上设置编码格式

  • PrintStream(File file, String csn)
  • PrintStream(String fileName, String csn)
  • PrintWriter(File file, String csn)
  • PrintWriter(String fileName, String csn) (注:PrintWriter类的构造方法可以接收OutputStream)
  • OutputStreamWriter(OutputStream out, Charset cs)(注:An OutputStreamWriter is a bridge from character streams to byte streams: Characters written to it are encoded into bytes using a specified charset. The charset that it uses may be specified by name or may be given explicitly, or the platform's default charset may be accepted.可知OutputStreamWriter发挥了桥梁的作用)

输入流

有哪些构造方法可以在参数上设置编码格式

  • InputStreamReader(InputStream in, Charset cs)
  • Scanner(File source, String charsetName)
  • Scanner(InputStream source, String charsetName)
  • Scanner(Path source, String charsetName)

其他可以设置编码的方法

  • String(byte[] bytes, Charset charset
  • getBytes(Charset charset) String的普通方法

相关文章:

  • 2021-11-28
  • 2021-05-24
  • 2021-06-14
  • 2021-11-26
  • 2022-12-23
猜你喜欢
  • 2022-01-19
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2022-02-03
  • 2022-12-23
相关资源
相似解决方案