Log in
updated 11:29 AM UTC, May 4, 2016

How to download Images in Java and how Threads help in downloading them faster

This program explains how to download an Image using Java. This uses Java thread's for parallelly downloading the Images.By commenting out the lines (1, 2 ,3 and 4 ) which is specified as the comments, the program downloads the images sequentially.

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import javax.imageio.ImageIO;

Add a comment (1)

  • Written by Madhu V Rao
  • Category: Core Java
  • Hits: 7502

How to read a Property file in Java?

How to read a Property file in Java and convert it to Set for comparison?

This program explains reading a property file and converting it to Set , so that it can be used for processing later.

class PropertyFileTest
{
    static Set<String> tagsMap = null;

    public static void main(String[] args)
    {
        Properties properties = new Properties();
        try
        {
            properties.load(new FileInputStream("listOfTags.properties"));

Add a comment (1)

  • Written by Madhu V Rao
  • Category: Core Java
  • Hits: 2471

How to parse an http XML file and convert it based on your need using JAVA and JAXP

This code parses the file from this location : http://ictforu.com/images/xml/matches.xml and then writes it to a local file "converted_matches.xml"

This Java class contains all the API's required to read and create an XML using JAXP. The API's used are pretty self explanatory.

 

package allxmls;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import org.w3c.dom.*;
import org.xml.sax.*;
import javax.xml.parsers.*;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

Add a comment (1)

  • Written by Madhu V Rao
  • Category: Core Java
  • Hits: 4663

Ways to increase the performance of XML processing in Java.

Ways to increase the performance of XML processing in Java.

I dont go into the details of which is better SAX parser or DOM parser.
We have used DOM parser as we wanted the performance to be higher and we didnt really care about the memory consumption.

In this article I will explain ways in which performance can be improved so that your xml processing can be quick.

Add a comment (1)

  • Written by Madhu V Rao
  • Category: Core Java
  • Hits: 9528

what is a transient variable? And give an example usage of the variable.

what is a transient variable? And give an example usage of the variable.

Ans: A transient variable is a variable that can not be serialized.
the transient keyword can be used to indicate the Java virtual machine that the variable is not part of the persistent state of the object.

This can be used in a scenario where only some of the fields in a class are required to be saved and others are actually dervied from the existing .

Add a comment (1)

  • Written by Madhu V Rao
  • Category: Core Java
  • Hits: 3702

Why Java is used in Devices like the set top box ?

Why Java is used in Devices like the set top box?

There are many reasons why Java is used in devices like the Set Top Box. Reason is The Java platform provides the following benefits:

  1. Portability across platforms: Write Once, Run Anywhere (operating system platform-independence)

    Add a comment (2)

  • Written by Madhu V Rao
  • Category: Core Java
  • Hits: 3778

Java Memory profiling

It’s an important task to profile your app for memory usage to optimize the way your program works on the system. Profiling is a first step in the improvement of your system.

There are many ways to profile; here I will explain few of the profiling methods which I have used over the years in different projects.

Add a comment (2)

  • Written by Madhu V Rao
  • Category: Core Java
  • Hits: 2554
Follow Us on Twitter
Find Us on Facebook
Follow Us on Google
Follow Us on Pinterest