Create Zip archive using Java

An example of compress file into zip file in java.

 Reference

1.http://docs.oracle.com/javase/6/docs/api/java/util/zip/ZipOutputStream.html

read more

Write Dom to Xml File (LSSerializer)

 

Example Output : justexample.xml

Reference
http://docs.oracle.com/javase/1.5.0/docs/api/org/w3c/dom/ls/class-use/LSOutput.html
http://docs.oracle.com/javase/1.5.0/docs/api/org/w3c/dom/bootstrap/DOMImplementationRegistry.html
http://docs.oracle.com/javase/1.5.0/docs/api/org/w3c/dom/ls/DOMImplementationLS.html

read more

Write Dom to Xml File (Transformer)

This example show you how to construct a Java Document Object Model (DOM) using DOM API and then write the DOM object into XML file.
 

Example Output : justexample.xml

Reference
http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/transform/Transformer.html#transform(javax.xml.transform.Source, javax.xml.transform.Result)

read more

Read a XML File (DOM)

Sample file : justexample.xml

 

Example Output

Reference
http://docs.oracle.com/javase/1.5.0/docs/api/org/w3c/dom/Document.html
http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/parsers/DocumentBuilderFactory.html

read more

Write file with PrintWriter

 


Reference
http://docs.oracle.com/javase/1.5.0/docs/api/java/io/PrintWriter.html
http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html

read more

Write file with BufferedOutputStream

 

Reference
http://download.java.net/jdk7/archive/b123/docs/api/java/io/BufferedOutputStream.html

read more

Move File

Example of move folder/files using Native I/O in java

Note :
Moving the parent folder will also moving all the child folder inside.

read more

Rename File

 Example of rename file in java

Reference
http://docs.oracle.com/javase/7/docs/api/java/io/File.html#renameTo(java.io.File)

read more

Write file with FileOutputStream

 

Reference
http://docs.oracle.com/javase/6/docs/api/java/io/FileOutputStream.html#write(byte[])

read more