Java tutorial translation Sequence Java Introduction Build a JSE development environment-install JDK and eclipse Language basics Java Hello World Program Analysis Variable Java Variables Java Native type Conversion of Java
, write-only; RW, read/write3) You can directly jump to the specified position in the file.4. An example of an I/O ApplicationImport java. Io .*;Public class testio {Public static void main (string [] ARGs)Throws ioexception {// 1. read data from a file in behavior unitsBufferedreader in =New bufferedreader (New filereader ("F: // nepalon // testio. Java "));Stri
, Java also provides a related class inetaddress. the instance of this object must be provided through its static method. its static method mainly provides the method of obtaining the local IP address and directly obtaining the inetaddress through the name or IP address.Okay. The above method can basically establish a line for the two computers to communicate with each other. But how is data transmitted? In fact, I/O operations are always closely rela
);} System. out. println ("from client:" + sb); // write a new OutputStreamWriter (socket. getOutputStream (); writer. write ("Hello Client. "); writer. flush (); writer. close (); reader. close (); socket. close ();}}}
In the code above, each time ServerSocket receives a new Socket connection request, a new thread will be started to communicate with the current Socket, in this way, the communication between asynchronous processing and client Socket is achieved.When receiving data from the Input
instance of the object must be provided through its static method. Its static method mainly provides the method of getting inetaddress directly from native IP and by name or IP.
Well, the above method can basically build a line for the two computers to communicate with each other. But how does the data transfer? In fact, I/O operations are always related to network programming. Because the underlying network is the continuation of the data. Unless remote invocation, the core of the handling
Dark Horse programmer-java basic IO stream-bytes stream buffer and word throttling, javaio
Shard Stream Buffer
L the emergence of a buffer increases the efficiency of reading and writing data.
L corresponding class
• BufferedWriter
• BufferedReader
L the buffer zone can be used only when combined with the stream.
L The streaming function is enhanced based on the stream.
1, BufferedWriter
Each time a row c
Computer questions (Elementary)-Java Network Operations Socket implementation client-server-side communication II (Java)
In the previous section, a client sends a request like a server. In this section, the server returns information to the client. The implementation principle is very simple. Based on the original principle, the server outputs a stream, you can implement the input stream on the client. The
Various streams in java (the instructor's youdao cloud Note), java youdaoMemory Operation stream-the file operation stream before the byte is based on the input and output of the file. When the output location changes to memory, it is called the memory operation stream. In this case, you must use the memory stream to complete the input and output operations of the memory. If some temporary files need to be
[This is my own study notes, welcome reprint, but please specify the source:http://blog.csdn.net/jesson20121020]
Socket Communication:The two programs on the network implement data interaction through a two-way communication connection, one end of the bidirectional link is called a socket. Sockets are typically used to connect clients and service parties. Sockets are a very popular programming interface for the TCP/IP protocol, and a socket is uniquely determined by an IP address and a port
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: It reads bytes and decodes them into charac
, including:
InputStream, OutputStream , Reader , Writer .
InputStreamAnd OutputStream , the two are designed for byte streams and are primarily used to process bytes or binary objects.
ReaderAnd Writer , the two are designed for character streams (1 characters in 2 bytes) and are primarily used to handle characters or strings.
The common System.in is actually InputStream object.Byte stream converted to character streamTo facilitate the processing of byte streams, we often
.
BufferedOutputStream implements buffered output streams. By setting this output stream, the application can write each byte to the underlying output stream without calling the underlying system for each byte write.
DataOutputStream data output stream allows applications to write Basic Java data types to the output stream in an appropriate manner. Then, the application can use the data input stream to read data.
4.2 streams
4.2.1 character input stre
Some people write Java for a while, but they still don't know much about Java package and import. Many people think that the import in the original code. Java file is similar to the # include in C/C ++. This is actually a wrong idea.
Let's take a look at the usefulness of Java package. In fact, the package name is like
directly return strings, therefore, BufferReader is more widely used than FileReader.BufferReader adopts the following two constructor methods.BufferReader (Reader in): Creates a BufferReader instance based on the Reader object represented by in. The buffer size uses the default value.BufferReader (Reader in, int sz): Creates a BufferReader instance based on the Reader object represented by in. The buffer size uses the specified sz value.The BufferReader. readLine () method encounters the follo
JAVA advanced-network programming, java advanced network programming> Connect to the server through a socketSocket refers to Socket> Read the homepage of any website---------
/** * @author Lean @date:2014-10-9 */public class SocketSample {public static void main(String[] args) {BufferedWriter writer=null;Socket socket=null;try {while (true) {try {Thread.sleep(1000);} catch (InterruptedException e) {e.pri
FileReader Read method, and FileReader called FileInputStream's native Read method. The so-called native method is the underlying method of the operating system. Then our operating system is the Chinese system, so fileinputstream default to read the file GBK way. Since we are saving test.txt with UTF-8, it is wrong to read the contents of the file here using GBK.3. 4. The browser decodes the characters in the way specified in the HTTP header, at which point the decoding is either GBK or UTF-8,
In the previous article, we gave about 35 questions, all of which are basic knowledge. Some children's shoes reflect that the questions are outdated. In fact, they are not. These are the foundation of the basics, but they are also essential, there are still some basic questions in the interview questions. We gradually give different levels of questions based on the principle of ease and difficulty. Continue with the 70 questions mentioned last time. This chapter will provide 13 typical questions
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.