1. 入出力クラス一覧
クラス名 | 拡張元 | コンストラクタ引数 | 主なメソッド | メソッドの機能 |
File | Object | String | createNewFile() | 新規にファイルを作成する |
String,String | delete() | ファイルを削除する | ||
File,String | exists() | ファイルの存在チェック | ||
getParent() | 親のパス文字列を返す | |||
isDirectory() | ディレクトリかどうか | |||
isFile() | ファイルかどうか | |||
list() | ディレクトリ内のファイル名のリストを返す | |||
mkdirs() | ディレクトリの作成 | |||
renameTo() | ファイル・ディレクトリの名前変更 | |||
FileWriter | Writer | File | close() | ファイルを閉じる |
String | flush() | バッファにあるデータを出力する | ||
write() | 書込み | |||
BufferedWriter | Writer | Writer | close() | ファイルを閉じる |
flush() | バッファにあるデータを出力する | |||
newLine() | 改行 | |||
write() | 書込み | |||
PrintWriter | Writer | File | close() | ファイルを閉じる |
String | flush() | バッファにあるデータを出力する | ||
OutputStream | format() | 書式を指定する | ||
Writer | printf() | 書式付き出力を行う | ||
print() | 出力 | |||
println() | 出力と改行 | |||
write() | 書込み | |||
FileReader | Reader | File | read() | ファイルの読み込み |
String | ||||
BufferedReader | Reader | Reader | read() | ファイルの読み込み |
readLine() | 1行分読む |
2. separator
Fileクラスにはパスの区切り文字を表す定数としてseparatorという変数がある