天道酬勤,学无止境

字节流

What is IO stream in Java, the difference between byte stream and character stream, code analysis of buffer stream principle

Speaking of receiving input valuesIn daily development and applications, sometimes it is necessary to directly receive input values ​​from external devices such as keyboards. For this data receiving method, we generally have three methods: byte stream reading, character stream reading, Scanner tool class Read.Byte stream readJust look at an example:public class Demo01SystemIn { public static void main(String[] args) throws IOException { int a = System.in.read(); System.out.println(a); char c = 'a'; System.out.println((int) c); } }After running the program, it will be blocked by the read method

2021-05-19 04:02:31    分类:博客    java   字节流   IO 流

The most detailed Java knowledge points-byte stream, character stream

Byte stream, character streammain contentIO streamByte streamCharacter streamException handling Propertiesthe goalCan tell the classification and function of IO flowAbility to write data to file using byte output streamAbility to read data to the program using byte input streamAble to understand the principle of the read(byte[]) method of reading dataAbility to copy files using byte streamAbility to write data to file using FileWirterCan tell the difference between the close and refresh methods in FileWriter5 ways to write data using FileWriterAbility to use FileWriter to write data to achieve

2021-05-13 16:05:37    分类:博客    字节流

Detailed java byte stream (with examples)

1.1 What is IO In your life, you must have experienced such a scene. When you edit a text file and forget ctrl+s , the file may be edited in vain. When you insert a USB flash drive into your computer, you can copy a video to your computer's hard drive. So which devices are the data on? Keyboard, memory, hard disk, external devices, etc.We regard this kind of data transmission as a flow of data. According to the direction of the flow, based on memory, it is divided into输入input and输出output , that is, the flow to the memory is the input flow and the output flow out of the memory. I/O operations

2021-05-13 10:19:24    分类:博客    字节流

The difference between byte stream and character stream

To output a piece of binary data to a device one by one, or to read a piece of binary data from a device one by one, no matter what the input and output device is, we need to use a unified way to complete these operations, using an abstract This abstract description method is named IO stream, and the corresponding abstract classes are OutputStream and InputStream. Different implementation classes represent different input and output devices, and they all operate on bytes. In applications, it is often necessary to output or read a piece of text that is entirely characters. Is it okay to use a

2021-04-19 10:14:07    分类:博客    字节流   字符流