1. The concept of byte stream and character stream1.1 Byte stream is inherited from InputStream OutputStream,1.2 character streams inherit from InputStreamReader OutputStreamWriter.There are many other streams in the java.io package, mainly to improve performance and ease of use.2. The difference between a byte stream and a s
byte stream is a binary stream processing character set. the byte stream is the smallest unit in the stream. , -128 to 127 of the information contained in a byte. that's all. A dense stream is the smallest unit in a stream. A ch
Standard input/output streamTwo member variables in the system class:public static final InputStream in "standard" input stream.public static final PrintStream out "standard" output stream.Pnputstream is = system.in;PrintStream PS = System.out;System.out; Standard output stream:You can see it from the top, actually. System.out.println ("HelloWorld");actually equals PrintStream PS = System.out; Ps.println ("HelloWorld");Attention: 1 printstream PS = System.out; 2 //The follo
stream is one of the most overlooked function series in PHP development (SPL series, stream series, pack function, encapsulation protocol), but it is a useful and important function. The stream can be translated as "stream", and the following is the use method In Java, streaming is a very important concept. The concep
means. Similar to the voltage in the circuit of high, low, transistor conduction and cutoff.
2) Binary number operation is simple, greatly simplifies the calculation of the structure of the operational components.
The addition and multiplication of binary numbers are as follows:
0+0=0 0+1=1+0=1 1+1=10
0x0=0 0x1=1x0=0 1x1=1
Because the binary number in the use of the median number is too long, not easy to remember, so the hexadecimal number is proposed.
3. Byte
Package Org.example.io;Import Java.io.ByteArrayInputStream;Import java.io.IOException;/*** Bytearrayinputstream: Pass in the array when creating the object, do not need to pass the file, there is no new method, close () Close invalid* The stream itself is an in-memory resource, and the content in the stream is also a resource in memory, so the memory is freed without manual shutdown, so there is no need to
Print Flow:There are two classes: The Printstream,printwriter class, the two class method is consistent, the difference is that the constructorPrintStream: Construction Method: Receive file type, receive string file name, receive byte output stream (OutputStream)Pringwriter: Construction Method: Receive file type, receive string file name, receive byte output stream (OutputStream), receive character output
Use of data flow (stream)
1) Stream's acquisition
① through the collection collection get
1
list2
stream
② is obtained by array
1
String[] Array = {"Are", "You", "OK"};2
stream3
4
Handling of primitive type arrays5
Int[] array = {1,2,3,4,5};6
stream
③ by value (as far as possible using the above 2 ways to get, this way there are defects)
1
1. Convert a picture to a binary stream: done by FileInputStream Public Static byte[] Change_to_stream (String path) {byte[] Imagebytes =NULL; //Use Try-with-resourse directly here, you can not manually close the resources Try(FileInputStream FileInputStream =NewFileInputStream (NewFile (path));) {Imagebytes=New byte[Fileinputstream.available ()]; Fileinputstream.read (imagebytes); } Catch(IOException e) {e.printstacktrace (); }
IO stream in java and javaIO stream
Stream: java stream is a class developed by Sun for file operations and data transmission, but it is called a stream. all opened streams must be closed because the opened streams consume resources and are insecure.
The objects in the
Stream is an abstract interface, and there are many objects in Node that implement this interface. For example, the Request object requesting the HTTP server is a Stream and stdout (standard output).Node.js,stream has four flow types:
readable -readable operation.
writable -writable operation.
Duplex -readable writable operation.
Transform -T
OverviewIO streams are used to process data transfer between devicesHow Java operates on data by streamingThe objects that Java uses to manipulate the flow are in the IO packageStream-by-operation data is divided into: byte stream and character streamFlow is divided into: input stream and output stream by different flowcommon base classes for IO streamsAbstract b
First, IntroductionThis article describes the node. js file System (FS) and the stream (stream) of some APIs that have been used for parameter usage.Second, the catalogueThe file system describes the following methods:1.fs.readfile2.fs.writefile3.fs.open4.fs.read5.fs.stat6.fs.close7.fs.mkdir8.fs.rmdir9.fs.readdir10.fs.unlinkThe stream
2017-11-05 20:15:28
Sequenceinputstream
SequenceinputStream:SequenceInputStreamRepresents a logical concatenation of other input streams. It starts with an ordered collection of input streams and reads from the first input stream until the end of the file is reached, then reads from the second input stream, and so on, until the end of the file containing the last input
Random access Flow, using mark (Mark) to mark the location of the stream, contains two methods of tell and seek;
Tell, which is the return stream Mark's location, contains G and P two versions. g denotes get, refers to the input stream; P means put, the output stream;
Seek is a jump to the position indicated by the
In the I/O class library, Java.io.InputStream and java.io.OutputStream represent byte input streams and byte output streams, which are abstract classes that cannot be instantiated, and the smallest unit in the data flow is bytes, so it is called a byte stream.The method of reading data in InputStream is as follows:1, int read ()Function: Reads a byte of data, and returns the read data, and if 1 is returned, it reads to the end of the input stream.2, i
Flow:is divided into the input stream and the output stream, the input/output is relative to the computer memory, the data input to the memory is the input stream, the data from the memory output is the output stream.The flow object is constructed with a data source associated with it.The data source is divided into: source data source and target data source. The
The difference between a character stream and a byte stream is A) The number of bytes per read is different B) The former is buffered, the latter is not C) The former is a character read-write, the latter is a byte read-write D) There is no difference between the two, which can be used interchangeably with Java stream operations are divided into byte
Byte stream summary, byte stream Summary
Byte stream Summary
InputStream (Abstract class: indicates the parent class of all byte input streams.)
|-FileInputStream (It is mainly used for raw byte streams such as image data.)
|-FilterInputStream (Simple RewritingInputStreamMethod)
|-BufferedInputStream (Provide buffering and other functions)
|-PipedInputStream (Mai
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.