Complementary knowledge points for serialization
----------------
Use objects for inter-network transport or localized storage.
Also called serialization
Procedure to convert Java objects to byte[]
Java.io.Serializable//serializable interface, identification. Jvm.
Serialized version UID://
Deep replication refers to copying an entire object graph.
Transient://Temp keyword.
Objectinputstream/objectouputstream
Bytearrayinputstream/Bytearrayoutputstream
Read (char c) write (byte[])
DataInputStream//Data input stream
DataOutputStream//Output output stream
byte[] bytes = "China". GetBytes ("iso-8859-1");
New String (Bytes, "iso-8859-1");
String.getbytes ("CharSet"); //For string encoding
New String (Bytes, "charset") '; //decoding
Use the Bin/native2ascii tool provided by the JDK to implement Chinese transcoding:
----------------------------------------------
1. Create a text file (GBK encoding, it is recommended to use Notepad. ) 1.txt
[1.txt]
You ABC good, China!
2. Enter the 1.txt directory with cmd
Cmd
3.native2ascii-encoding gb2312 1.txt 2.txt
Ui:user interface
--------------------------
1.GUI://graphic user interface
2.Label://tags, cannot be edited, display text
3.Button//button
4.Checkbox//check box
5.RadioBox//radio button
6.Menubar//menu bar
7.Menu//Menu
8.MenuItem//menu item
9.Toolbar//toolbar
10.Statusbar//status bar
11.TitleBar//title bar
12.Scrollbar//scroll bar
13.Taskbar//taskbar
14.active//activated
15.deactive//passivated
16.TextField//text box, single line
17.TextArea//Text field, multiple lines
18.password//Password box
Socket
----------------------
1. Sockets.
2.client/server://client/server
3.ServerSocket://server-side socket, receive request.
4.ss.accept ()//Accept
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/82/62/wKiom1dTnJ7CE_j7AABw3aIN_Eg919.png "title=" 241809453054816.png "alt=" Wkiom1dtnj7ce_j7aabw3ain_eg919.png "/>
Exception type in socket usage
--------------------
The following four types are inherited from IOException: So a lot of the ioexception can be ejected directly.
Unkownhostexception: host name or IP error
Connectexception: The server refused the connection, the server did not start, (exceeded the number of queues, refused to connect)
Sockettimeoutexception: Connection timed out
Bindexception: The socket object cannot be bound to the established local IP address or port
Socket method
---------------------
Getinetaddress (); IP address on remote server
Getport (); Ports on the remote server
getlocaladdress () IP address of the local client
Getlocalport () port of the local client
getInputStream (); Get input stream
Getoutstream (); Get the output stream
It is worth noting that in these methods, the most important is getinputstream () and Getoutputstream ().
Socket status
-----------------------
IsClosed (); If the connection is closed, returns true if it is turned off, otherwise false
Isconnect (); Returns true if it has ever been connected; false otherwise
Isbound (); Returns true if the socket is already bound to a local port, otherwise false
Tcp
----------------------
1.transfer control protocal, transmission protocol
2. You must first establish a connection, a reliable protocol. No data loss.
Udp
---------------------
1.User Datagram protocal, User Datagram protocol.
2. Without first establishing a link, unreliable protocol (relying on a reliable network), data loss (related to the reliability of the current network).
Mvc
------------------------
1.model-view-controller, Model View Control
"DAY16" 16th day Socket Socket Learning Note