图中我们可以看出,以字节为单位的输出流的公共父类是OutputStream:

从中我们可以看出,以字节为单位的输出流的公共父类是OutputStream:
(1)OutputStream是以字节为单位的输出流的超类,提供了write()函数从输出流中读取字节数据。
(2)ByteArrayOutputStream是字节数组输出流,写入ByteArrayOutputStream的数据被写入到一个byte数组,缓冲区会随着数据的不断写入而自动增长,可使用toByteArray()和toString()获取数据。
(3)PipedOutputStream是管道输出流,和PipedInputStream一起使用,能实现多线程间的管道通信。
(4)FilterOutputStream是过滤输出流,是DataOutputStream,BufferedOutputStream和PrintStream的超类
(5)DataOutputStream是数据输出流,用来装饰其他的输出流,允许应用程序以与机器无关方式向底层写入基本Java数据类型。
(6)BufferedOutputStream是缓冲输出流,它的作用是为另一个输出流添加缓冲功能。
(7)PrintStream是打印输出流,用来装饰其他输出流,为其他输出流添加功能,方便的打印各种数据值
(8)FileOutputStream是文件输出流,通常用于向文件进行写入操作。
(9)ObjectOutputStream是对象输出流,它和ObjectInputStream一起对基本数据或者对象的持久存储。

基于JDK8的源代码分析:

public abstract class OutputStream implements Closeable, Flushable {
    //写特定的字节到输出流
    public abstract void write(int b) throws IOException;
    //写特定的长度的字节数组到输出流中
    public void write(byte b[]) throws IOException {
        write(b, 0, b.length);
    }
    //从b数组中,起始值为off,长度为len的数据到输出流中
    public void write(byte b[], int off, int len) throws IOException {
        if (b == null) {
            throw new NullPointerException();
        } else if ((off < 0) || (off > b.length) || (len < 0) ||
                ((off + len) > b.length) || ((off + len) < 0)) {
                throw new IndexOutOfBoundsException();
        } else if (len == 0) {
            return;
        }
        for (int i = 0 ; i < len ; i++) {
            write(b[off + i]);
        }
    }
    //刷新输出流,强制任意的缓冲输出都被输出
    public void flush() throws IOException {
    }
    //关闭输出流,释放与这个输出流相关的所有系统资源
    public void close() throws IOException {
    }
}

最新文章

  1. hibernate 多表查询
  2. APNS远程推送(转发)
  3. iOS开发者必备的10款工具
  4. C++实现大数据乘法
  5. sping配置文件中引入properties文件方式
  6. PHP中的定界符格式
  7. js一些小知识点
  8. 同步文件的利器-rsync
  9. TableLayout
  10. Oracle中session和processes的设置
  11. [Educational Codeforces Round 7]F. The Sum of the k-th Powers
  12. 最简单获取appPackage和appActivity 的方法
  13. [No0000197]Windows用户都应该知道的运行命令
  14. Linux 文件系统与挂载详解
  15. [UE4]网络游戏重点思考
  16. 每天学一点easyui②
  17. DNS之XX记录
  18. [BZOJ2878][NOI2012]迷失游乐园(环套树DP+概率)
  19. python开发_re和counter
  20. python fire库的使用

热门文章

  1. jvm(三):对象
  2. Java的数组排序
  3. Windows笔记目录
  4. Kafka(转载)
  5. 四柱加强版汉诺塔HanoiTower----是甜蜜还是烦恼
  6. 安装Leanote极客范的云笔记
  7. ABP文档笔记 - 规约
  8. popen() 使用举例 (转载)
  9. freemarker的使用
  10. CentOS7.2安装Weblogic12c出现的问题