Basic Application of socket. io tutorial (2) socket. io tutorial
Preface
Socket. IO supports timely, bidirectional, and event-based communication. It can work on every platform, every browser, and every device, with the same reliability and speed.
Real-time analysis: push
IO stream 05 -- video Study Notes for bixiangdong JAVA basic tutorial, 05 -- bixiangdong
Day20
10 create a java file list11 Properties12 Properties access13 Properties14 Properties exercises15 PrintWriter16 merge streams17. Cut files
10 create a java file list
Exercise:Store the absolute path of a java file under a specified directory to a text file,Create a java file list file.
Ideas:1. recursion of the s
IO stream 03 -- video Study Notes for bixiangdong JAVA basic tutorial, 03 -- bixiangdong
Abstract
16 read the conversion stream17 write a conversion stream18 stream operation rules-119 stream operation rules-220. Change the standard input/output device21 abnormal log information22. System Information
16 read the conversion stream
InputStreamReader in the dense stream system is a bridge between byte streams
step will go to github to download npm files and progress, and the fourth step is to install npm to node. js will copy several cmd files and the mode_modules folder to the nodejs directory.
In this way, npm is configured.
If you need to install any modules, enter npm install ***.
If there is no npm or windows users can use github to download socket. io and put it into the node_modules folder. For detailed configuration, refer to: nodejs
increase the content in the a.txt to make the read time longer,Code, create main3.js write the above code, use Reatereadstream to create a read stream object, use on the object to listen to "data" to read the event, each read a piece of data, will trigger this event, when read, it will trigger an "end" event.With the execution of Main3.js, we can see the results printed below, from multiple lines of printed "...", and we can see that reading is done more than once.Will read to the data, slowly
above functions;2>: Redirect Error output2>>: Append mode redirect Error output>: Redirect standard output or error output to the same file2. Input redirection:Iv. Pipeline:The output of the previous command, as input to the latter commandExample: 1. Display the number of rows in a file does not display the file nameWc-l/etc/passwd | Cut-d '-f12. Count the number of files in the/usr/bin directory;Ls/usr/bin | Wc-l3. Remove all shells from the current user, requiring each shell to be displayed o
] {
System.out.println (line);
line = Br.readline ();
}
Br.close ();
}
catch (IOException e) {
System.out.println ("IO Problem");}}
This program contains a try...catch...finally exception handler. Exception handling can be referenced in the Java Advanced Tutorial
Adorners and functional combinations
The key to program IO
reading, or 1, if it returns to the end of theparameter: char[] character array
while loop read, condition: If the length of the read is not -1
Combining strings
FileReader fr=New filereader ("test.txt"); Char [] buf=newchar[2]; int len=0; StringBuilder SB=new StringBuilder (); while ((Len=fr.read (BUF))!=-1) { sb.append (new String (buf,0, Len)); } System.out.println (Sb.tostring ());
PHP version, file operation, write
Call t
Org.apache.commons.io.input and Org.apache.commons.io.output packages contain a wide variety of implementations for data streams. Including:Empty output stream-silently absorbing all the data sent to it? T-output stream-all two output streams replace one for sending? byte array output stream-this is a faster version of the JDK class? Count Stream-Calculates the number of bytes passedProxy flow-Use the correct method to dragLock write-use locked files to provide synchronous writesFor more inform
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.