Breaking News
Home / Java (page 4)


How to parse ShoutCast/IceCast Stream Metadata in Java?

Snippet StreamScraper is a java library that can be used to harvest streaming metadata (current song title, genre, current listener count, etc.) from SHOUTcast/IceCast servers. Usage import; import java.util.List; import net.moraleboost.streamscraper.Stream; import net.moraleboost.streamscraper.Scraper; import net.moraleboost.streamscraper.scraper.IceCastScraper;   public class   Harvester{    public static void main(String[] args)throws Exception    { …

Read More »

How to download Image from URL and save it in Java?

Snippet import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import; import; import;   public class ImageDownloader {           public static void main(String[] args )     {         BufferedImage image =null;         try{               URL …

Read More »

How to check if WEP Key is valid in Java?

Snippet  private static final Pattern HEX_DIGITS = Pattern.compile("[0-9A-Fa-f]+");     /**    * Check if wepKey is a valid hexadecimal string.    * @param wepKey the input to be checked    * @return true if the input string is indeed hex or empty.    * False if the input string …

Read More »

How to convert a String as Quoted String in Java?

Snippet  /**    * Encloses the incoming string inside double quotes, if it isn’t already quoted.    * @param string: the input string    * @return a quoted string, of the form "input".  If the input string is null, it returns null    * as well.    */   static …

Read More »

How to convert a Base64 Encoded Stream into an Image using Java?

Snippet import java.awt.image.BufferedImage; import; import;   import javax.imageio.ImageIO;   import sun.misc.BASE64Decoder;   public class Base64ImageTest {     public static void main(String args[]);      {         // this is not the real stream just for example         String base64String = "BORw0KGgoAAAANSUhEUgAAAUAAAAHgCAYAAADUjLREAAAgAElEQVR4AexdB4B …

Read More »