Title: ????java.io?????
1?????9?
2Goal?Objective
- Goal??????????????????????????
????????????????java.io??????????????????
????????????????? - Objective??????????????????????????java.io????
????????java.io?????????????????????
3????????
- ??????(CUI?) ??????????????
???????1.????? 2.??????? 3.????? 4.???????
5.??????? 6.?????????? 3 ????500? cola120?? sod
a120? ??????0????? ?????????0???????? ?????????
??????? cola cola??????? ????380??????
4?????????????
- ??????????????? ????????????????????
5????????????
????????(???????????)??????????????????????????
6????????
?????????????????RDB
??????????
7lt??gt???????????????
BufferedReader br new BufferedReader(new
FileReader(???1.log)) ??? br.readLine()
br.close()
PrintWriter pwnew PrintWriter(newFileWriter(???1
.log)) fw.write(???) fw.close()
8lt??gt?????????????
//DB?URL?????? String url
"jdbcinterbase//etude.crew.sfc.keio.ac.jp//home
/bam/jihanki.gdb" //DB???????????????
????? java.sql.Connection conn
java.sql.DriverManager.getConnection( url ,
"sysdba" , "masterkey" )
//SQL??????????????????(resultSet)?????
String sqlString "select from user_info"
java.sql.Statement statement
conn.createStatement() java.sql.ResultSet
rs statement.executeQuery( sqlString )
9????????
?????????????????????? ?????????????
10??????????lt??gt
ObjectOutputStream ??
new ObjectOutputStream(new FileOutputStream(????.
log)) ??.writeObject(????)
??.close()
11??????????lt??gt
ObjectInputStream ?? new
ObjectInputStream(new FileInputStream(????.log)
) ????(?????)??.readObject() ??.close()
12java.io.Serializable????????
public class ????? implements Serializable
13????
- BufferedReader
- FileReader/Writer
- PrintWriter
- ObjectOutputStream/InputStream
????????????????????????????????????????
14????????
????????????????????(??????????????????????)
15java.io????????
???????????????????? ????????????????????
- ???????????????????????????????
- ??????????????????
16???????
- ????InputStream/OutputStream????????
(ObjectOutputStream/InputStream??)?)FileInputStre
am?ByteArrayInputStream - ???Reader/Writer?????????)FileReader?CharArrayWr
iter - ??????ObjectOutputStream/InputStream
17????
- ????FileOutputStream/InputStream/Reader/Writer
- StringStringReader/Writer(String????????Stream??
????) - ???????InputStreamReader
18???
??????????????????
- FileReader
- ObjectInputStream
- ByteArrayOutputStream
?????????????????
??????????????
?????byte????????????
19??????????
- BufferedReader ????????????????????
??????????????????? ??????? - PrintWriter ?????????????????? ????????????????
20???
BufferedReader br new BufferdeReader(new
InputStream(System.in)) String ??br.readLine()
?????????????????????????????
21????
PrintWriter pw new PrintWriter(new
FileWriter("test.txt")) pw.println("test")
??????????????????????????
22???
Java.io?????????????????????????????????
23?????
?????????????????? ???????????????? ?????????
???????