Friday, June 19, 2015
Thursday, June 11, 2015
Mule Fundamentals Video Tutorial
|
Wednesday, June 10, 2015
Intellij IDEA for Students FREE (1 Year)
Folks,
Jetbrains is offering Intellij IDEA Ultimate Edition for one year FREE for students with edu email address. If you are student and you got .edu email address go and download the most intelligent IDE.
https://www.jetbrains.com/estore/students/
Happy Coding!
Jetbrains is offering Intellij IDEA Ultimate Edition for one year FREE for students with edu email address. If you are student and you got .edu email address go and download the most intelligent IDE.
https://www.jetbrains.com/estore/students/
Happy Coding!
Friday, June 5, 2015
Send Command / Process to Back Ground From Terminal
Here are the list of command to send a process or command to back ground from terminal
1) Press ctrl+z
2) Then type bg (bg means back ground)
3) Then type "disown"
To make sure process is running in back ground execute below command,
ps auxw | grep
1) Press ctrl+z
2) Then type bg (bg means back ground)
3) Then type "disown"
To make sure process is running in back ground execute below command,
ps auxw | grep
Saturday, April 18, 2015
Friday, April 3, 2015
XML To JSON Converter
Have the following jars in the classpath,
commons-beanutils-1.6.1.jar
commons-collections-3.2.jar
commons-lang-2.1.jar
commons-logging-1.1.jar
ezmorph-1.0.4.jar
json-lib-2.3-jdk15.jar
xom-1.0.jar
import net.sf.json.JSON;
import net.sf.json.xml.XMLSerializer;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
public class XML2JSONConverter {
public String convertXMLTOJSON(String inputXML) {
String jsonString = "";
try {
JSON objJson = new XMLSerializer().read(inputXML);
jsonString = objJson.toString();
} catch (Exception e) {
e.printStackTrace();
}
return jsonString;
}
static String convertStreamToString(java.io.InputStream is) {
java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
return s.hasNext() ? s.next() : "";
}
public static void main(String[] args) throws Exception {
File inputFile = new File("input xml file path");
InputStream inputStreams = new FileInputStream(inputFile);
XML2JSONConverter toJASON = new XML2JSONConverter();
System.out.println("JASON Object:" + toJASON.convertXMLTOJSON(convertStreamToString(inputStreams)));
}
}
commons-beanutils-1.6.1.jar
commons-collections-3.2.jar
commons-lang-2.1.jar
commons-logging-1.1.jar
ezmorph-1.0.4.jar
json-lib-2.3-jdk15.jar
xom-1.0.jar
import net.sf.json.JSON;
import net.sf.json.xml.XMLSerializer;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
public class XML2JSONConverter {
public String convertXMLTOJSON(String inputXML) {
String jsonString = "";
try {
JSON objJson = new XMLSerializer().read(inputXML);
jsonString = objJson.toString();
} catch (Exception e) {
e.printStackTrace();
}
return jsonString;
}
static String convertStreamToString(java.io.InputStream is) {
java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
return s.hasNext() ? s.next() : "";
}
public static void main(String[] args) throws Exception {
File inputFile = new File("input xml file path");
InputStream inputStreams = new FileInputStream(inputFile);
XML2JSONConverter toJASON = new XML2JSONConverter();
System.out.println("JASON Object:" + toJASON.convertXMLTOJSON(convertStreamToString(inputStreams)));
}
}
Java InputStream to String Covertion
Found this small method to convert InputStream to String, This will help to avoid using Apache IOUtils etc.,
static String convertStreamToString(java.io.InputStream is) {
java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
return s.hasNext() ? s.next() : "";
}
static String convertStreamToString(java.io.InputStream is) {
java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
return s.hasNext() ? s.next() : "";
}
Subscribe to:
Posts (Atom)