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 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          2.21 Java notes - Streams and Files

          Posted on 2007-04-22 20:24 ZelluX 閱讀(380) 評論(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");
          主站蜘蛛池模板: 滦平县| 喀喇| 桑植县| 岳普湖县| 琼中| 旌德县| 奇台县| 大同市| 武冈市| 通江县| 沙湾县| 千阳县| 剑川县| 尼木县| 遂宁市| 新建县| 静安区| 南投市| 沙河市| 久治县| 封开县| 介休市| 门源| 公安县| 宝坻区| 东乡族自治县| 紫阳县| 虹口区| 文昌市| 榆树市| 株洲市| 沙河市| 邓州市| 元朗区| 建德市| 怀宁县| 乳山市| 扎赉特旗| 遂川县| 进贤县| 吴川市|