Bufferedoutputstream (New FileOutputStream (FILENAME));Os.writeobject (Serialobject);Os.close ();Read the dataObjectInputStream is = new ObjectInputStream (new FileInputStream (FILENAME));Is.readobject ();Is.close ();Read or write a jar or zip documentZipFile zippy = new ZipFile ("A.jar");Enumeration all = Zippy.entries (); Enumeration values list all file listswhile (All.hasmoreelements ()) {ZipEntry entry = (zipentry) all.nextelement ();if (Entry.isfile ())println ("Directory:" + entry.getnam
key pair needs to be keypass.C:\Program files\java\jre7\bin>keytool-genkey-alias catserver-keyalg rsa-keysize 1024-sigalg Sha256withrsa-keypa SS Catserver-keystore C:\_tmp\catserver.keystore-storepass Catserverkswhat is your first and last name? [Unknown]: Catwhat is the name of the Your organizational unit? [Unknown]: Catwhat is the name of your organization? [Unknown]: Catwhat is the name of your city or Locality? [Unknown]: Catwhat is the name of
();
Client.close ();
} catch (IOException e) {
e.printstacktrace ();}}}
Close IO Object
Similar to file Io, after reading and writing data is completed, we need to shut down the IO object to ensure the correct release of the resource.
Server-Side Authoring
Open the server-side socket
int port = 8919;
ServerSocket Server = new ServerSocket (port);
Socket socket = server.accept ();
The above code creates a server
Optimization of Java (Android) code for performance optimizationThis article is the third--java (Android) code optimization for Android performance optimization. This paper mainly introduces the performance optimization methods and network optimization in Java
Generate a QR code image or base64 format string by passing in a string1 Public StaticString Barcode2base64 (String msg)throwsexception{2QRCode x =NewQRCode ();3 //N Represents the number, a represents a-z,b for other characters4X.setqrcodeencodemode (' B ');5 //set error correction level6X.setqrcodeerrorcorrect (' M ');7 //Set version number (1-40)8X.setqrcodeversion (7);9
Here is the specific code:Package com.jinzhi.tes2;Import Java.awt.Color;Import Java.awt.Font;Import Java.awt.Graphics;Import Java.awt.Graphics2D;Import Java.awt.image.BufferedImage;Import java.io.FileNotFoundException;Import Java.io.FileOutputStream;Import java.io.IOException;Import Javax.imageio.ImageIO;Use Java classes to draw a simple QR codepublic class Imgdemo {public static void Main (string[] args) {
"Next"EXE in BuildOK, finish, click "Exit" toLet's see what we've achieved!Our executable jar and third-party jar in total less than 5M, can jre5 directory of more than 50 m, if the target machine has a JRE environment can delete it, the Lib directory is a third-party jar file, is now packaged in the EXE, so it does not exist for reasons, then the minimum configuration is left " Simulate.exe "and" config "Directory!5. RemarksThe above steps are basically the steps that you have already tried, s
that I don't have a blog. Try your best, when you are free.3. Considering the severity of the problem with the codeWrite their own follow-up very rubbish, nothing to consider. Just so-called, do not know should not throw an exception, should not use Singleton. Should not interface ... A lot of things are coming from bad. Refactoring is a very good start. Reading is also.The book is much read. You're going to be cheerful.It is called, be okay. There is no good book. You learn books as well. I'm
Main (string[] args) {Copy ();}static void Copy () {Reader reader = null;BufferedReader br = null;writer writer = null;BufferedWriter bw = NULL;try {Part I: Preparing to read data from a file to a programreader = new FileReader (New File ("D://a.txt"));Create a buffered stream wrapper object readerbr = new BufferedReader (reader);Part two: Preparing to write to
To execute the JS code in Java, first understand that Java does not support the method of the browser itself. Support Custom JS method, otherwise it will be an errorFirst create a new JS file: Jsss.jsThe contents are as follows: function AA (b) { return +b;}Then write the code in
JUnit is a widely used Java unit testing framework, but it does not provide the support of parametric testing, many testers have to write the test data in the program or other methods to achieve the separation of data and code, in the subsequent modification and maintenance of a lot of restrictions and inconvenience. Feed4junit is an open source, JUnit-based extension that allows users to easily store test
.000setvariable ("Curdate", DateTime, "s");In addition, if you are using the field values from the previous node, it is easier to modify the variable values as follows:(4) using variables (as used in general):1.1.5 Java code access variable call jar package and generate validation fileThis is a more comprehensive example, first defines a record (probably understood as many variables), and then through the
Zxing is a Google dedicated to the compilation, solution two-dimensional code, barcode, open source project, the use and operation are very convenient. Zxing does not support Java and supports other classes of applications such as Android, CPP, C #, IPhone, J2ME, J2SE, JRuby, OBJC, Rim, Symbian, and more. You can add the required class libraries to your needs. This article refers to some of the types in htt
control.Android also offers some of the more powerful data types, such as Sparsearray, Sparsebooleanarray, Sparseintarray, and Pair.The data structure of the sparse series is a special process for the case of the key int, using binary lookup and simple array storage, plus the overhead of not requiring a generic conversion, and better performance than the map. But I don't quite understand why the default capacity size is 10, is it statistical, or now memory optimization does not need to consider
Blog migration to: http://www.micmiu.com
Following the introduction of a Japanese open source software (the software can only achieve QRCode) Original: Java implementation of two-dimensional code QRCode coding and decoding (http://sjsky.iteye.com/blog/1136934), today found another excellent open source weapon--zxing , it is more flexible and convenient, and can realize many coding formats.
Full-Text catal
() { System.out.println(Thread.currentThread().getName() + "running...."); } }
2. Reduce network overhead. when interacting with a database or remote service, try to merge multiple calls into one call.
3. cache frequently accessed external resources to the memory. You can simply use static hashmap to load resources when the application is started, or use some open-source cache frameworks, such as Oscache and ehcache. for synchronization with resources, you can take the initiative to
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.