At work, I also learned that Pack,unpack,ord is powerful for binary byte processing. Let me introduce them to you. In our work, there is not much estimation of their use. I am in a recent job, because the communication needs to use the binary stream, and then the interface is received in PHP. At that time, a lot of information was consulted. Because they are really less used, they are seldom used by friends in their work. At work, I also learned that
1. Io Stream (Overview of IO Stream and its classification)
1. Concept
IO streams are used to process data transfer between devices
The Java operation of the data is streamed through the way
The classes that Java uses to manipulate the flow are in the IO package
Flows are divided i
transmitting data4 classes are abstract classes can not be instantiated, need to pass 4 abstract classes provided by the method to implementV. InputStream Architecture 5.1, byte input stream base classFileInputStream: Reading data from a fileStringBufferInputStream: Rotate the string into the input stream, this class is obsolete and replaced by StringbufferreaderPipedInputStream: Connecting a PipedOutputSt
line number for text file input stream
DataInputStream
Input stream containing methods for reading Java standard data types
Bufferedinputstream
Buffered input stream
Pushbackinputstream
Returns a byte and puts this byte back into the input
-classes are required. For example, dateinputstream and dataoutputstream allow us to read and write all basic java types.
The file stream class is similar to the abstract inputstream and outputstream classes. These classes only support byte-level read/write operations. In other words, you can only read character and byte arrays from the fin object. Byteb =
sometimes you need to change the dense stream to the byte stream form or the byte to the dense stream form. Therefore, you need another set of Operation classes for the conversion stream.
Conversion steps:If the file operation is used as an example, character data in the
Problem:(1) The IO stream of Java uses the adornment mode, when closing the outermost stream, it automatically calls the close () side of the wrapped stream?(2) If the flow is closed sequentially, is it from the inner laminar to the outer stream closed or from the outer to t
): Pipedreader, PipedWriter, PipedInputStream, PipedOutputStream
3.File file Stream
Read and write to files: FileReader, FileWriter, FileInputStream, FileOutputStream
4. Objectserialization
Object input, Output: ObjectInputStream, ObjectOutputStream
5.DataConversion Data Flow
Read and write by basic data type (processed data is the basic type of Java (such as Boolean, Byte, Integer, and floating-point numbe
/* A novel buffer usage is pushback ). Pushback is used to input the stream to allow the byte to be read and then return (that is, "Push Back") to the stream. The pushbackinputstream class implements this idea. It provides a mechanism to "peat" What is generated by the input stream without being damaged. Pushbackinputstream has two constructors: pushbackinputstre
At work, I also learned that Pack,unpack,ord is powerful for binary byte processing. Let me introduce them to you. In our work, there is not much estimation of their use. I am in a recent job, because the communication needs to use the binary stream, and then the interface is received in PHP. At that time, a lot of information was consulted. Because they are really less used, they are seldom used by friends in their work. At work, I also learned that
Now, the online spark-based code is basically Scala, a lot of books are based on Scala, no way, who called Spark is Scala written out, but I do not have a systematic study of Scala, so I can only use Java to write Spark program, Spark supports Java, and Scala is based on the JVM, not to mention, directly on the codeThis is the official online example, the Big Dat
include fileinputstream/fileoutputstream, Bytes/bytearrayoutputstream, etc. The IO classes acting as decorative functions include bufferedinputstream/inputs, and datainputstream,They all inherit from the decoration interface filterinputstream/filteroutputstream.When I/O is used, create a data source I/O first, and then create a decoration class I/O Based on the required functions. The constructor parameter is the created data source I/O.Taking the creation of a buffer file input
1. java implements data input and output through the concept of stream, or reading and writing is easier to understand. The following four classes are the base classes of all streams, which process the reading and writing of bytes and characters respectively:
Inputstream: input (read) byte stream abstract class.
Outputstream: output (write) byte
Classes or interfaces related to Java stream operations:Java Flow class diagram structure:concept and function of flowA stream is a set of sequences of bytes that have a starting point and an end point, a generic or abstract of the data transfer. That is, the transmission of data between the two devices is called the flow, the essence of the flow is data transmis
beginning, pointer = 0; 3 Raf.write (byte); // The Write method writes only one byte while the direct pointer points to the next position int b = raf.read (); // each time a byte is read, each character in Java occupies two bytes, and a 8-bit right shift is used to write 5 raf.seek (pointer position) in a split-second way; // Move the pointer 6 raf.close (); // file read and write must be closed, otherwise there may be unintended consequencesThis app
and reader, because System.in is a byte stream, it needs to be packaged and then transformed into a character streams supply bufferedreader use.
3. PrintWriter out1 = new PrintWriter (new BufferedWriter) (New FileWriter ("Iodemo.out"));
This statement embodies a Java input and output system of a feature, in order to achieve a certain purpose, need to wrap several layers. First of all Output destination is
/* The sequenceinputstream class allows multiple inputstream streams to be connected. The construction of sequenceinputstream is different from any other inputstream. The sequenceinputstream constructor either uses a pair of inputstream or an enumeration of inputstream. The output is as follows: sequenceinputstream (inputstream first, inputstream second) sequenceinputstream (enumeration streamenum, this class meets the read requirements for reading the first inputstream and then forwarding the s
Classes or interfaces related to Java stream operations:Java Flow class diagram structure:concept and function of flowA stream is a set of sequences of bytes that have a starting point and an end point, a generic or abstract of the data transfer. That is, the transmission of data between the two devices is called the flow, the essence of the flow is data transmis
Original address: http://www.cnblogs.com/oubo/archive/2012/01/06/2394638.htmlClasses or interfaces related to Java stream operations:Java Flow class diagram structure:concept and function of flowA stream is a set of sequences of bytes that have a starting point and an end point, a generic or abstract of the data transfer. That is, the transmission of data between
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.