【转】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字节流与字符流的区别详解
字节流与字符流 先来看一下流的概念: 在程序中所有的数据都是以流的方式进行传输或保存的,程序需要数据的时候要使用输入流读取数据,而当程序需要将一些数据保存起来的时候,就要使用输出流完成. 程序中的输入 ...
随机推荐
- mysqldump备份与恢复笔记
mysql> show databases; +--------------------+ | Database | +--------------------+ | inf ...
- nodejs+mocha+supertest+chai进行测试(only demo)
1.nodejs安装成功 (上一篇:brew install nodejs) 2.mocha安装成功 npm install -g mocha 解释: -g代表global,全局的意思.此处mocha ...
- WPF canvas设置旋转角度和偏移位置
/// <summary> /// 设置旋转角度和位置 /// </summary> /// <param name="Angle">角度< ...
- MySQL 存储修改
真的坑.
- 01 Python初识
基础: 1.后缀名是py ATT: 单个文件执行,后缀无所谓 2.两种执行方式 终端 python+文件路径 解释器内部: 直接执行 3.解释器路径: #/usr/bin/env pyth ...
- python调用cmd显示中文乱码及调用cmd命令
os.system('dir') 解决方法加上 os.system('chcp 65001') ____________________________________________________ ...
- Android Jetpack 概述
Android Jetpack Overview Android Jetpack Jetpack is a set of libraries, tools and architectural guid ...
- springboot2系列目录
参考:https://blog.csdn.net/cowbin2012/article/details/85254990 带源码
- leetcode198
public class Solution { public int Rob(int[] nums) { ; ; ; k < nums.Length; k++) { int tmp = i; i ...
- 【原】The Linux Command Line - Manipulation Files And Directories
cp - Copy Files and directories mv - move/rename files and directories mkdir - create directories rm ...