码迷,mamicode.com
首页 > 移动开发 > 详细

【转】Closeable, Readable, Flushable, Appendable

时间:2018-07-07 20:28:18      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:close   nio   tor   releases   box   https   views   sha   and   

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

标签:close   nio   tor   releases   box   https   views   sha   and   

原文地址:https://www.cnblogs.com/zhangyue123/p/9277547.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!