right4_7_1.htm

来自「清华JAVA教程。不用多说了吧」· HTM 代码 · 共 65 行

HTM
65
字号
<html><head><title>JAVA编程语言</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><link rel="stylesheet" href="../../../css/text.css" type="text/css"></head><body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" ><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">  <tr>     <td valign="top">       <table width="96%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">        <tr>          <td valign="top">             <p class="pt9-black">   这两个类是抽象类,只是提供了一系列用于字符流处理的接口,不能生成这两个类的实例,只能通过使用由它们派生出来的子类对象来处理字符流。<br>              <br>               <span class="zhongdian">1.Reader类是处理所有字符流输入类的父类。<a name="01"></a><br>              </span><br>                <b>◇ 读取字符 </b><br>                public int read() throws IOException; //读取一个字符,返回值为读取的字符<br>                public int read(char cbuf[]) throws IOException; /*读取一系列字符到数组cbuf[]中,返回值为实际读取的字符的数量*/<br>                public abstract int read(char cbuf[],int off,int len) throws IOException;               <br>                /*读取len个字符,从数组cbuf[]的下标off处开始存放,返回值为实际读取的字符数量,该方法必须由子类实现*/<br>              <br>                <b>◇ 标记流</b><br>                public boolean markSupported(); <font color="339900">//判断当前流是否支持做标记</font><br>                public void mark(int readAheadLimit) throws IOException; <br>                 <font color="339900">//给当前流作标记,最多支持readAheadLimit个字符的回溯。</font><br>                public void reset() throws IOException;<font color="339900"> //将当前流重置到做标记处</font><br>              <br>                <b>◇ 关闭流</b><br>                public abstract void close() throws IOException;<br>              <br>               <span class="zhongdian">2. Writer类是处理所有字符流输出类的父类。<a name="02"></a>               </span><br>              <br>                <b>◇ 向输出流写入字符</b><br>                public void write(int c) throws IOException;<font color="339900"><br>                //将整型值c的低16位写入输出流</font><br>                public void write(char cbuf[]) throws IOException;<font color="339900"><br>                //将字符数组cbuf[]写入输出流</font><br>                public abstract void write(char cbuf[],int off,int len) throws               IOException;<br>                <font color="339900">//将字符数组cbuf[]中的从索引为off的位置处开始的len个字符写入输出流</font><br>                public void write(String str) throws IOException;<br>                <font color="339900">//将字符串str中的字符写入输出流</font><br>                public void write(String str,int off,int len) throws IOException;<br>                <font color="339900">//将字符串str 中从索引off开始处的len个字符写入输出流</font><br>              <br>                <b>◇ flush( )</b><br>                刷空输出流,并输出所有被缓存的字节。<br>              <br>                <b>◇ 关闭流</b><br>                public abstract void close() throws IOException;<br>            </p>            </td>        </tr>      </table>    </td>  </tr></table></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?