0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

java.ioについて

Posted at

java.ioは入出力処理についてのライブラリ。
大きく分けて以下の3つがある。
 1. バイトストリーム系(InputStream、OutputStream)
 2. 文字ストリーム系(Reader、Writer)
 3. ファイル操作系(File)

java.io
├── InputStream
│ ├── FileInputStream
│ ├── BufferedInputStream
│ ├── DataInputStream
│ └── ObjectInputStream

├── OutputStream
│ ├── FileOutputStream
│ ├── BufferedOutputStream
│ ├── DataOutputStream
│ └── ObjectOutputStream

├── Reader
│ ├── FileReader
│ ├── BufferedReader
│ ├── InputStreamReader
│ └── StringReader

├── Writer
│ ├── FileWriter
│ ├── BufferedWriter
│ ├── OutputStreamWriter
│ └── PrintWriter

└── File

javaプログラムはメモリ上で動いているため、テキストファイル(ディスクに保存されている)などに出力する時は「メモリ⇔ディスク」の書き込み、読み込みが必要。
その書き込みや読み込みを助けてくれるライブラリ。

文字ストリームでテキストファイルを出力する流れ

・javaプログラム
  "こんにちは"

・文字ストリームで指定された文字コードでバイトに変換
  E3 81 93・・・・(UTF8で変換)

・バイトストリームでバイト列をディスクに書き出し
  test.txt
  E3 81 93・・・・

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?