【转】Closeable, Readable, Flushable, Appendable
Closeable:
package java.io; import java.io.IOException; public interface Closeable {
/**
* Closes this stream and releases any system resources associated
* with it. If the stream is already closed then invoking this
* method has no effect.
*/
public void close() throws IOException;
}
Readable:
package java.lang; import java.io.IOException; public interface Readable { /**
* Attempts to read characters into the specified character buffer.
* The buffer is used as a repository of characters as-is: the only
* changes made are the results of a put operation. No flipping or
* rewinding of the buffer is performed.
*/
public int read(java.nio.CharBuffer cb) throws IOException;
}
Flushable:
package java.io; import java.io.IOException; public interface Flushable { /**
* Flushes this stream by writing any buffered output to the underlying stream.
*/
void flush() throws IOException;
}
Appendable:
package java.lang; import java.io.IOException; public interface Appendable { /**
* Appends the specified character sequence to this Appendable.
* @return A reference to this Appendable
*/
Appendable append(CharSequence csq) throws IOException; /**
* Appends a subsequence of the specified character sequence to this Appendable.
* @return A reference to this Appendable
*/
Appendable append(CharSequence csq, int start, int end) throws IOException; /**
* Appends the specified character to this Appendable.
* @return A reference to this Appendable
*/
Appendable append(char c) throws IOException;
}
转自:https://blog.csdn.net/jjavaboy/article/details/43093435
【转】Closeable, Readable, Flushable, Appendable的更多相关文章
- java IO之AutoCloseable,Closeable和Flushable接口
有3个接口对于流类相当重要.其中两个接口是Closeable和Flushable,它们是在java.io包中定义的,并且是由JDK5添加的.第3个接口是AutoColseable,它是由JDK7添加的 ...
- java io流之字符流
字符流 在程序中一个字符等于两个字节,那么java提供了Reader.Writer两个专门操作字符流的类. 字符输出流:Writer Writer本身是一个字符流的输出类,此类的定义如下: publi ...
- java IO之字节流和字符流-Reader和Writer以及实现文件复制拷贝
接上一篇的字节流,以下主要介绍字符流.字符流和字节流的差别以及文件复制拷贝.在程序中一个字符等于两个字节.而一个汉字占俩个字节(一般有限面试会问:一个char是否能存下一个汉字,答案当然是能了,一个c ...
- Java IO 四大附加接口、try-with-resource
Java IO 四大附加接口.try-with-resource @author ixenos 四大附加接口 Closeable.Flushable.Readable.Appendable Close ...
- 走进JDK(四)------InputStream、OutputStream、Reader、Writer
InputStream InputStream是java中的输入流,下面基于java8来分析下InputStream源码 一.类定义 public abstract class InputStream ...
- 学习笔记(三)--->《Java 8编程官方参考教程(第9版).pdf》:第十章到十二章学习笔记
回到顶部 注:本文声明事项. 本博文整理者:刘军 本博文出自于: <Java8 编程官方参考教程>一书 声明:1:转载请标注出处.本文不得作为商业活动.若有违本之,则本人不负法律责任.违法 ...
- IO流 简介 总结 API 案例 MD
目录 IO 流 简介 关闭流的正确方式 关闭流的封装方法 InputStream 转 String 的方式 转换流 InputStreamReader OutputStreamWriter 测试代码 ...
- java 字节流与字符流的区别详解
字节流与字符流 先来看一下流的概念: 在程序中所有的数据都是以流的方式进行传输或保存的,程序需要数据的时候要使用输入流读取数据,而当程序需要将一些数据保存起来的时候,就要使用输出流完成. 程序中的输入 ...
- Java字节流与字符流的区别详解
字节流与字符流 先来看一下流的概念: 在程序中所有的数据都是以流的方式进行传输或保存的,程序需要数据的时候要使用输入流读取数据,而当程序需要将一些数据保存起来的时候,就要使用输出流完成. 程序中的输入 ...
随机推荐
- 学习 MeteoInfo二次开发教程(四)
教程四的问题不大. 1.private void AddMapFrame_ChinaSouthSea().private void AddTitle()两个函数和public Form1()函数并列. ...
- Servlet 知识点总结(来自那些年的笔记)
2018年04月15日 20:16:01 淮左白衣 阅读数:350 版权声明:转载请给出原文链接 https://blog.csdn.net/youngyouth/article/details/ ...
- python字符串前面的r/u/b的意义 (笔记)
u/U:表示unicode字符串 : 不是仅仅是针对中文, 可以针对任何的字符串,代表是对字符串进行unicode编码. r/R:非转义的原始字符串: 与普通字符相比,其他相对特殊的字符,其中可能包含 ...
- json初接触
<html lang="en"> <head> <meta charset="UTF-8"> <meta name=& ...
- 系统计划 Cron作业 为什么/etc/crontab /etc/cron.d /etc/cron.* 那么多的定义方式????
当我们要增加全局性的计划任务时,一种方式是直接修改/etc/crontab.但是,一般不建议这样做,/etc/cron.d目录就是为了解决这种问题而创建的.例如,增加一项定时的备份任务,我们可以这样处 ...
- BASEDIR
1)正常写python程序会有一个可执行的bin.py文件,假如这个文件需要导入my_module里面定义的模块,应该怎么设置sys.path(此时可以直接导入), 因为bin和model属于同级目录 ...
- jquery中的 deferred之 deferred对象 (一)
案例: var def=$.Deferred(); console.log(def);//答案见 图1 图1: deferred就是一个有这些方法的对象. 看源码分析: Deferred: funct ...
- [Ting's笔记Day4]将Ruby on Rails项目部署到Heroku
今天想笔记的是把自己写的Ruby on Rails项目部署(Deploy)到Heroku! Heroku是Salesforce公司旗下的云端服务商,支持多种程序语言像是Ruby,PHP,Python等 ...
- 爬虫 1 requests 、beautifulsoup
1.requests 1.method 提交方式:post.get.put.delete.options.head.patch 2.url 访问地址 3.params 在url中传递的参数,GET p ...
- nginx实现http www服务的方式