1. Stream Zoo 的基礎:四個抽象類,InputStream, OutputStream, Reader, Writer
          其中后面兩個使用于Unicode文本。
          2. 四個接口
          interface Closeable {void close() throws IOException}
          interface Flushable {void flush() throws IOException}
          這兩個比較簡單
          interface Readable {int read(CharBuffer cb)}
          其中CharBuffer提供了支持連續/隨機讀寫操作的方法
          Appendable接口有兩個方法,用于追加單個字符或一列字符
          Appendable append(char c)
          Appendalbe append(CharSequence s)
          CharSequence是另一個接口。
          java.lang.CharSequence 1.4
          char charAt(int index)
          int length()
          CharSequence subSequence(int startIndex, int endIndex)
          String toString()
          3. FileInputStream和FileOutputStream
          構造方法:
          FileInputStream fin = new FileInputStream("employee.dat");
          File f = new File("employee.dat");
          FileInputStream fin = new FileInputStream(f);
          注意輸入Windows文件路徑的時候使用雙\\,如"C:\\Windows\\a.ini",不過也可以是"c:/Windows/a.ini",不過這并不被提倡。
          讀入一個字節:byte b = (byte) fin.read();
          3. System.getProperty 方法
          public static String getProperty(String key)
          返回key值對應的屬性
          posts - 403, comments - 310, trackbacks - 0, articles - 7
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          日歷

          <2007年4月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          相冊

          搜索

          •  

          積分與排名

          • 積分 - 337505
          • 排名 - 167

          最新評論

          2.21 Java notes - Streams and Files

          Posted on 2007-04-22 20:24 ZelluX 閱讀(379) 評論(0)  編輯  收藏 所屬分類: OOP
          2007-02-21 20:18:22
          Key Description of Associated Value
          java.version Java Runtime Environment version
          java.vendor Java Runtime Environment vendor
          java.vendor.url Java vendor URL
          java.home Java installation directory
          java.vm.specification.version Java Virtual Machine specification version
          java.vm.specification.vendor Java Virtual Machine specification vendor
          java.vm.specification.name Java Virtual Machine specification name
          java.vm.version Java Virtual Machine implementation version
          java.vm.vendor Java Virtual Machine implementation vendor
          java.vm.name Java Virtual Machine implementation name
          java.specification.version Java Runtime Environment specification version
          java.specification.vendor Java Runtime Environment specification vendor
          java.specification.name Java Runtime Environment specification name
          java.class.version Java class format version number
          java.class.path Java class path
          java.library.path List of paths to search when loading libraries
          java.io.tmpdir Default temp file path
          java.compiler Name of JIT compiler to use
          java.ext.dirs Path of extension directory or directories
          os.name Operating system name
          os.arch Operating system architecture
          os.version Operating system version
          file.separator File separator ("/" on UNIX)
          path.separator Path separator (":" on UNIX)
          line.separator Line separator ("\n" on UNIX)
          user.name User's account name
          user.home User's home directory
          user.dir User's current working directory

          如要得到當前目錄,使用String dir = System.getProperty("user.dir");
          51La
          主站蜘蛛池模板: 乌恰县| 嵩明县| 灵宝市| 丰都县| 宝兴县| 新蔡县| 宁夏| 抚顺市| 女性| 鹤山市| 区。| 磐石市| 新泰市| 新宾| 莆田市| 张家港市| 昌平区| 驻马店市| 丹巴县| 万宁市| 清水县| 新竹县| 乌拉特中旗| 盈江县| 山阳县| 罗江县| 鄱阳县| 乌拉特前旗| 锦州市| 司法| 南丹县| 临武县| 九江市| 竹北市| 蓝山县| 洮南市| 丹棱县| 潞西市| 安国市| 象山县| 商水县|