码迷,mamicode.com
首页 > 编程语言 > 详细

JavaIO 流(1)IO流介绍

时间:2019-12-14 09:21:14      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:func   class   定义   pre   有序   技术   header   get   https   

IO流定义:

流的本质是一组单向有序,分起始和终止的数据传输过程。需要导入import java.io.*

IO流分类:

按数据类型分为:字节流和字符流

字节流:
按字节进行读取(可以处理任意类型数据)
字符流
字节流 + 编码表(处理纯文本数据优先考虑)

技术图片

按数据流向分为:输入流和输出流

输入流
有Reader(字符输入流)、InputStream(字节输入流)
输出流
有Writer(字符输出流)、OutputStream(字节输出流)

按复杂程度分为:基本流和包装流

基本流
包装流

IO 流四大基类

InputStream (字节输入流)

技术图片

1
2
3
public abstract class 
extends Object
implements Closeable

构造方法及成员方法

?InputStream() //是所有数据输入字节流的基类

1
2
3
4
5
6
7
8
9
int         available()

void close()
void mark(int readlimit)
boolean markSupported()
abstract int read()
int read(byte[] b)
int read(byte[] b, int off, int len)
void reset()
long skip(long n)

OutputStream (字节输出流)

技术图片

1
2
3
public abstract class OutputStream
extends OutputStream
//字节流可以处理以字节为单位的任何数据类型

构造方法及成员方法

?OutputStream() //是所有数据输出字节流的基类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
abstract void	write_any(Any value)
abstract void write_boolean_array(boolean[] value, int offset, int length)

abstract void write_boolean(boolean value)

abstract void write_char_array(char[] value, int offset, int length)

abstract void write_char(char value)

void write_Context(Context ctx, ContextList contexts)

abstract void write_double_array(double[] value, int offset, int length)

abstract void write_double(double value)

void write_fixed(BigDecimal value)

abstract void write_float_array(float[] value, int offset, int length)

abstract void write_float(float value)

abstract void write_long_array(int[] value, int offset, int length)
大专栏  JavaIO 流(1)IO流介绍>
abstract void write_long(int value)

abstract void write_longlong_array(long[] value, int offset, int length)

abstract void write_longlong(long value)
W
abstract void write_Object(Object value)

abstract void write_octet_array(byte[] value, int offset, int length)

abstract void write_octet(byte value)

void write_Principal(Principal value)

abstract void write_short_array(short[] value, int offset, int length)

abstract void write_short(short value)

abstract void write_string(String value)

abstract void write_TypeCode(TypeCode value)

abstract void write_ulong_array(int[] value, int offset, int length)

abstract void write_ulong(int value)

abstract void write_ulonglong_array(long[] value, int offset, int length)

abstract void write_ulonglong(long value)

void write(int b)

Reader (字符输入流)

技术图片

1
2
3
public abstract class Reader
extends Object
implements Readable, Closeable

构造方法及成员方法

?Protected Reader()

Protected Reader(Object lock)

1
2
3
4
5
6
7
8
9
10
abstract void   close()
void mark(int readAheadLimit)
boolean markSupported()
int read()
int read(char[] cbuf)
abstract int read(char[] cbuf, int off, int len)
int read(CharBuffer target)
boolean ready()
void reset()
long skip(long n)

Writer (字符输出流)

技术图片

1
2
3
public abstract class Writer
extends Object
implements Appendable, Closeable, Flushable

构造方法及成员函数

?protected Writer()

protected Writer(Object lock)

1
2
3
4
5
6
7
8
9
10
Writer	        append(char c)
Writer append(CharSequence csq)
Writer append(CharSequence csq, int start, int end)
abstract void close()
abstract void flush()
void write(char[] cbuf)
abstract void write(char[] cbuf, int off, int len)
void write(int c)
void write(String str)
void write(String str, int off, int len)

JavaIO 流(1)IO流介绍

标签:func   class   定义   pre   有序   技术   header   get   https   

原文地址:https://www.cnblogs.com/lijianming180/p/12037914.html

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