Java serialization Serializable (detailed example)
1. What is serialization and deserialization?Serialization is a process of describing objects in a series of bytes. deserialization is a process of recreating these bytes into an object.
2. Under what circumstances should serialization be performed?A) when you want to save the objects in the memory to a file or database;B) when you want to use a socket to
Java compressed file tool class ZipUtil usage code example, tool class ziputil
This example uses the Java Zip input/output stream to compress and decompress files. The first part of the code is used to obtain the file path and change the compressed file name. The details are as follows:
Package com.utility.zip; import
In this example, FileChannel and BufferedInputStream are used for test and comparison.
TestHandler. java is used to implement dynamic proxy and test the running efficiency.
Package com. test; import java. lang. reflect. invocationHandler; import java. lang. reflect. method; import
This article mainly introduces the example code for Java to generate and parse XML files and strings. For more information, see section 1. basic knowledge:
Java parses XML in four ways: DOM, SAX, JDOM, and DOM4J.
2. Introduction1) DOM(1) Introduction
The interface provided by W3C (org. w3c. dom) reads the entire XML file into the memory and constructs a DOM tree
This article will discuss about Thread pool with fixed number of thread. From Java 5.0 + one can get such pool from Executors using following method-Public static ExecutorServiceNewFixedThreadPool (int nThreads)Creates a thread pool that reuses a fixed number of threads operating off a shared unbounded queue. at any point, at most nThreads threads will be active processing tasks. if additional tasks are submitted when all threads are active, they will
Step1: Select the interface "National Weather forecast Interface" aggregated data url:http://www.juhe.cn/docs/api/id/39/aid/87 The example in this article
Step2: Each interface needs to pass in a parameter key, which is equivalent to the user's token, so the first step is to apply for a key.
step3: The students who have studied Java know that when we do not understand a class or method of their intentions
. util. stringtokenizer # hasmoretokens () * @ see Java. util. stringtokenizer # nexttoken (string) */Public void Test2 () {This. printseparater ("Test2"); stringtokenizer tokenizer = new stringtokenizer (source1); While (tokenizer. hasmoretokens () {system. out. println (tokenizer. nexttoken (delim1 ));}}
/*** A comprehensive example that splits a sentence and splits each word. In this
Struts 2 The default expression language is OGNL, because it has the following advantages over other expression languages:1. Support Object method invocation, such as xxx.dosomespecial ();2. Support class static method invocation and value access, expression format is @[class full name (including package path)]@[Method name | Value name], for example: @java. Lang.string@format (' foo%s ', ' Bar ') or @tutor
RMI is the specification for remote calls on the Java platform. The following is a small example.
There are three Java classes, remote interfaces, server programs, and client programs.
Remote interface:
Import java. RMI .*;
Public interface helloin extends java. RMI. Remote
From: http://blog.csdn.net/ladofwind/archive/2005/01/11/248820.aspx
RMI is the specification for remote calls on the Java platform. The following is a small example.
There are three Java classes, remote interfaces, ServerProgram, Client program
Remote interface:
Import java. RMI .*;
Public interface helloin
in the parameter when outputting the file:Note: If the path error, such as the deletion of a folder will be an error, as long as the error, even if the folder is set up will still report the directory error (as if there is memory function), then must be restarted Kettle to run correctly. l Use parameters and regular expressions to mix the scenes with the output file:Application of 1.1.3 kettle.properties parameters in Java codeUse variables in 1.1.4
thinking from Java single example and single case
Objective
A few days ago accidentally saw an article, talked about the cliché of a single example, holding a review of the mentality points in, or those familiar with the content, but found himself thinking of the angle changed, before more is to remember, only stay on the surface, and now more is to think why
is more thorough, and there is basically no need to make any changes, and there is a corresponding method for the background language. If you know this, it's easy to do.
For example, if you want to change this example to a Java version, if the Java architecture does not support authentication, split the homepage into
permissions (these constructors are used for tuning). */Package Org.rui.pattern2;import Java.util.*;import junit.framework.*;/** * In the above example, the static factory () method causes all operations that create objects to be concentrated in one place , which is the only place where you need to change the code. This is certainly a good solution, which encapsulates the process of creating objects. However, the design pattern emphasizes the use of
In the previous article we talked about MongoDB's command to get started, this blog will be based on the database and table established in the previous blog to complete a simple Java MongoDB CRUD Example, the use of Java to connect MongoDB database, and the implementation of database creation, get the table, Routines such as traversing objects in a table, CRUD op
Start the code.The first is tag, which is rarely used after college. I didn't expect it to be used again now. The code is as follows:Copy code To write tags, you need to introduce the jstl package. Google will have it. Two packages, one jstl and one standard, are required before 1.2. After 1.2, it seems to be merged into one. To use ajax requests, you need to introduce the jquery package. This is also introduced when echarts is introduced.In the above code, the most important thing is th
development process based on these three major elements.
Now let's take a look at a life example, if one day you walk on the road accidentally by a drop in the sky Vase hit, and fainted dead past. The whole process is actually an event-handling process, and we can easily analyze the three major elements of the event-driven model that we just mentioned.
1. The person who is stunned is actually the source of the event, because he is the source of the
parameter constructor that uses the standard JAXP DOMJava code
Instead of XPP3 and xmlpull libraries, the XML is parsed using the standard JAXP dom.
XStream XStream = new XStream (new Domdriver ());
c) A parameter constructor that uses Stax to parse XMLJava code
You don't need a XPP3 library here, but you need to use Java 6.
XStream XStream = new XStream (new Staxdriver ());
3 to convert a
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.