I think any book about the mode can't help but mention its practical application when talking about the decorator mode-applications in the Java/IO library,
I. Introduction (General Introduction to Java I/O)
Regardless of the programming language, input and output are an important part. Java is no exception, and
Java core programming-byte stream of IO stream (2), javaio
1. byte stream
A 1.1-byte stream is a stream that operates byte. Byte streams can operate on any data, such as media data, music, movies, and images. Of course, they can also operate on characters. Byte stream is based on byte stream, we know that a byte is 8 binary bits, a byte corresponds to an English character in the UTF-8, people found that usi
Today saw a netizen write Java file monitoring, real-time monitoring file loading, suddenly think of commons-io in the implementation of this function, first review to write a simple demo:There are three ways of doing this:1, Java Common.io Internal implementation is the way of traversal, small folder efficiency is good, such as I test 60G directory, very slow ve
1.java.io under the BagFile class : An object of this class in a Java program that corresponds to a file on the hard disk or to a resource in the network.File File1 = new file ("D:\\io\\helloworld.txt");File File2 = new file ("D:\\io\\io1");>1.file can represent either a file (. doc. xls. mp3. avi. jpg. dat) or a file directory!The objects of the >2.file class ar
of a read file, FileReader inherited the Inputstreamer, a file stream is read into the character set buf, through the Streamdecoder to complete the decoding operation of the byte.How to access the file:(1) Standard access method: (Read operation ")Disk--Cache--Kernel space (Write operation)(2) Direct IO operation(3) Simultaneous accessAs the name implies, the file read and write operations are synchronous, you must wait until the file read and
IO ExampleThe following is a presentation of the file file.txtHello world! Hello nerd!Let's look at an example of a file read:Import java.io.*;public class test{public static void Main (string[] args) {try{BufferedReader br =New BufferedReader (New FileReader ("file.txt"));String line = Br.readline ();while (line! = null) {System.out.println (line);line = Br.readline ();}Br.close ();}catch (IOException e) {System.out.println ("
Use Java IO, Java NIO, Netty to implement a simple echoserver (that is, returning the client's input information as is).Java IOint port = 9000; ServerSocket ss = new ServerSocket (port), while (true) {final socket socket = ss.accept (), New Thread (new Runnable () {public void Run () {while (true) {try {bufferedinputst
(byte[] buf,int offset,int len);Specifies the source of the byte input stream in the constructor parameterMethods to read from the stream:public int read (), which reads a byte from the source, which returns a byte value.public int read (byte[] buf) that reads bytes from the source into the parameter buf, which returns the number of bytes actually read out. If no bytes are read, return-1Similarly: byte array output stream Bytearrayoutputstream (), parameter optional int type byte size, default
Illustration of Java IO: 1. File source code, iofile
Writer: BYSocket)
Weibo: BYSocket
Bean flap: BYSocket
FaceBook: BYSocket
Twitter: BYSocket
I remember that the Java source code was first read by the set. I wrote a series of articles related to the set, which was well evaluated. Thank you. I will still read the old articles and write them vividly. This is stil
Selector.select () blocking mode), or to sell a ticket while waiting for a new train to arrive (non-blocking mode using Selector.selectnow ()) This selector returns NULL to allow the thread to execute other code logic.IO vs. NIONiO makes I/O more efficient than traditional I/O. In a program with a high percentage of I/O operations, think about what's different. For example, if an application needs to use a socket to copy files or transfer bytes, using NIO may result in faster performance becaus
following figure out the type of various types of how to use, who contains who, to clarify the idea.The 2:inputstream class is the abstract class of the byte input stream, which is the parent class of all byte input streams, and the InputStream class has a hierarchy as shown;The characters in the 3:java are Unicode encoded and are double-byte. InputStream is used to process bytes, which is inconvenient when dealing with word literals.
Java IO stream learning summary and javaio stream Summary
Classes or interfaces related to Java stream operations:
Java stream class diagram structure:
Concept and function of stream
A stream is a set of sequential bytes with a starting point and an ending point. It is a general term or abstraction for data transmi
Io Stream and Propertiesio streamAn IO stream is an interface between a computer and the outside world or between a program and the rest of the computer. It is critical for any computer system,Thus the body of all I/O is actually built into the operating system. Separate programs generally allow the system to do most of the work for them.In Java programming, I/O
Java. io provides a comprehensive IO Interface, including file read/write and standard device output. In Java, IO is input and output based on a stream. All data is serialized into the output stream or read from the input stream. In specific use, many beginners are very vagu
Java io Stream learning Summary io stream content is more, roughly can be divided into byte stream and character stream, in order to improve efficiency and the use of buffer.Classes or interfaces related to Java stream operations:concept and function of flowA stream is a set of sequences of bytes that have a starting p
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.