Java高級プログラミング7-姜国海流操作
JAvaはプログラミング言語だけではありません
API:アプリケーションインタフェース
①class File
オペレーティングシステムに保存される時間は、ミリ秒単位の長い整数です.
絶対パスと相対パス
②RandomAccessFile
③テキストフロー
PrintWriterクラス
PrintStream
テキストストリームのプロパティ(構成)config
API:アプリケーションインタフェース
①class File
:
:
File(File parent, String child)
Creates a new File instance from a parent abstract pathname and a child pathname string.
Eg:
File f1 = new File("c:\\");
File f2 = new File(f1,"a.txt");
file://c:\\a.dat
file://
オペレーティングシステムに保存される時間は、ミリ秒単位の長い整数です.
絶対パスと相対パス
,
②RandomAccessFile
,
③テキストフロー
FileInputStream file = new FileInputStream(new File("a.txt"));
Reader:
FileReader fr = new FileReader("a.txt");
int c = fr.read();
char c2 = (char)c;
FileInputStream fis = new FileInputStream("a.txt");
InputStreamReader isr = new InputStreamReader(fis,"GBK");//
BufferedReader br = new BufferedReader(isr );
String s = br.readLine();
import java.io.*;
public class WriteText {
public static void main() throws Exception{
FileOutputStream fos = new FileOutputStream("d:\\a.txt");
OutputStreamWriter osw = new OutputStreamWriter(fos,"GBK");
}
}
PrintWriterクラス
PrintStream
テキストストリームのプロパティ(構成)config
.properties
property
map, put
String getProperty(String name);
setProperty(String name);
server = www.baidu.com
Eg:
Properties p = new Properties();
p.load()
p.setProperty("server","192.168.0.0");