java reader

Reader类ready()方法 (Reader Class ready() method)

  • ready() method is available in java.io package.

    ready()方法在java.io包中可用。

  • ready() method is used to check whether this stream is ready to be read or not.

    ready()方法用于检查此流是否已准备好被读取。

  • ready() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.

    ready()方法是一种非静态方法,只能通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。

  • ready() method may throw an exception at the time of checking the state of the stream.

    在检查流的状态时, ready()方法可能会引发异常。

    IOException: This exception may throw when getting any input/output error.

    IOException:遇到任何输入/输出错误时,可能引发此异常。

Syntax:

句法:

    public boolean ready();

Parameter(s):

参数:

  • It does not accept any parameter.

    它不接受任何参数。

Return value:

返回值:

The return type of the method is boolean, it returns true when this stream is ready (i.e. input data is available for the next read) otherwise it returns false.

该方法的返回类型为boolean ,当此流准备就绪时(即输入数据可用于下一次读取)返回true,否则返回false。

Example:

例:

// Java program to demonstrate the example
// of boolean ready() method of Reader
import java.io.*;
public class ReadyOfR {public static void main(String[] args) throws Exception {Reader r_stm = null;
try {// Instantiates Reader
r_stm = new StringReader("JavaWorld!!!!");
// By using ready() method is to
// check whether this stream r_str
// is ready to be read or not
boolean status = r_stm.ready();
System.out.println("r_stm.ready(): " + status);
} catch (Exception ex) {System.out.println(ex.toString());
} finally {// with the help of this block is to
// free all necessary resources linked
// with the stream
if (r_stm != null) {r_stm.close();
}
}
}
}

Output

输出量

r_stm.ready(): true

翻译自: https://www.includehelp.com/java/reader-ready-method-with-example.aspx

java reader

java reader_Java Reader ready()方法与示例相关推荐

  1. java散列法的运用实例,Java HashMap compute() 使用方法及示例

    Java HashMap compute() 使用方法及示例 Java HashMap compute()方法计算一个新值,并将其与哈希映射中的指定键相关联. compute()方法的语法为: has ...

  2. math的用法在java中的使用,Java Math cbrt() 使用方法及示例

    Java Math cbrt() 使用方法及示例 Java Math cbrt()方法返回指定数字的立方根. cbrt()方法的语法为: Math.cbrt(double num) 注意:cbrt() ...

  3. java arraylist 方法返回值,Java ArrayList get() 使用方法及示例

    Java ArrayList get() 使用方法及示例 Java ArrayList get()方法返回指定位置存在的元素. get()方法的语法为: arraylist.get(int index ...

  4. java reader_Java Reader reset()方法与示例

    java reader 读取器类的reset()方法 (Reader Class reset() method) reset() method is available in java.io pack ...

  5. java kryo_Kryo框架使用方法代码示例

    Kryo框架的source已移至https://github.com/EsotericSoftware/kryo ,进入此页面,然后点击右边的Download Zip按钮,就能下载到最新版本的Kryo ...

  6. Java Math toIntExact() 使用方法及示例 long转int

    Java Math toIntExact()方法从指定的long参数返回int值. toIntExact()方法的语法为: Math.toIntExact(long value) 注意:toIntEx ...

  7. java readtimeout_Java HttpURLConnection.getReadTimeout方法代码示例

    import java.net.HttpURLConnection; //导入方法依赖的package包/类 /** * 得到响应对象 * * @param urlConnection * @retu ...

  8. java invalidate_Java Component.invalidate方法代码示例

    import java.awt.Component; //导入方法依赖的package包/类 /** Installs the component we will embed to display t ...

  9. java hasmoreelements_Java IOException.hasMoreElements方法代码示例

    import java.io.IOException; //导入方法依赖的package包/类 /** * fileName���� ���� package �������� ������ ���� ...

最新文章

  1. Java设计模式之代理模式(Proxy)
  2. 堆排序-Python
  3. 《2022博客之星拉票专用帖》
  4. vb.net中的-String类
  5. 高级数据结构与算法 | AVL树 (高度平衡树)
  6. mac安装python3.7两个版本_MAC下同时安装Python2和Python3
  7. linux下部署tomcat的备忘
  8. Bailian4118 开餐馆【DP】
  9. re模块常用修饰符_re模块中常用功能函数
  10. 生产宕机dunp配置
  11. 了解:shell脚本+脚本优化+脚本注入+正则表达式
  12. Mantis1.2.19 在Windows 平台上的安装配置详解
  13. Java编程降序排序代码,Java选择排序(升序跟降序)
  14. 海思HI3559和海思HI3559A的区别以及Hi3559c开发板
  15. thrift编写规则,及常见问题
  16. Gabor滤波器学习
  17. 零件加工 贪心 题解
  18. 数据价值应用——数据分析
  19. 怎么用命令远程重启服务器,使用命令行重启Windows服务器的方法
  20. CSDN知名安卓博主

热门文章

  1. python 当前文件路径获取方式_Python获取当前文件路径
  2. 辽宁412想学计算机科学技术,辽宁理工学院计算机科学与技术专业2016年在辽宁理科高考录取最低分数线...
  3. python stdin和stdout_stdin似乎比stdout(python)慢得多.为什么?
  4. Poor God Water【矩阵快速幂】
  5. Fighting_小银考呀考不过四级【递推】
  6. Linux的启动流程简析(以Debian为例)
  7. Linux Shell获取系统资源使用百分比(CentOS)
  8. 怎么将oracle的sql文件转换成mysql的sql文件
  9. 报表在IBM AIX系统下resin部署
  10. objective-C CollectionView 加深(添加注册头部View)