Skip to main content

Posts

Showing posts from May, 2008

Java Library to get Folder Content

FolderContentLib is the java library published under GPL license written by Chandima prabath ariyarathna . Using this library, you can check all file and file path inside the folder include the file which are include in the subfolders . Features:- File content(String folderPath) Using this method you can get file names which are inside the folder.This method return String Array. PathContent(String folderPath) Using this method you can get file names and path which are inside the folder.This method return String Array. How to access:- Example source code to access library. If you want to get source code Click on the picture Download Lib Download Source

Open source license

software licensing Allowing an individual or group to use a piece of software. Nearly all applications are licensed rather than sold. There are a variety of different types of software licenses. Some are based on the number machines on which the licensed program can run whereas others are based on the number of users that can use the program. Most personal computer software licenses allow you to run the program on only one machine and to make copies of the software only for backup purposes. Some licenses also allow you to run the program on different computers as long as you don't use the copies simultaneously Reference:-webopedia GNU LESSER GENERAL PUBLIC LICENSE Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented b

Get Local Ip address using java

Its very simple ,for the testing you want to import "java.net.InetAddress" package //Get an instance of InetAddress for the local computer InetAddress inetAddress = InetAddress.getLocalHost(); //Get a string representation of the ip address String ipAddress = inetAddress.getHostAddress(); //Print the ip address System.out.println(ipAddress);

Java Source code to check patition free space in Linux & Windows

this is java code for check free space in partition.. private static final Pattern NON_DIGIT = Pattern.compile("(([^0-9]*))"); private static final Pattern WORDS = Pattern.compile("(\\s*(\\S+)\\s*)"); public static long getFreeSpace(File file) { final String osName = System.getProperty("os.name"); try { if (osName.indexOf("Windows") != -1) { return freeSpaceWindow(file); } else if (osName.equals("Linux")) { return freeSpaceUnix(file); } else { System.err.println("Unknown os=" + osName); return freeSpaceUnix(file); } } catch (IOException ex) { ex.printStackTrace(System.err); return -1; } } // end getFreeSpace private static long freeSpaceUnix(File file) throws IOException { Process process = Runtime.getRuntime().exe

How to write Port Scaner using Java

This is source code for port scanner.Very easy to implement.If port is available return true.If port is unavailable return false. public static boolean PortScanner(String host,int port) throws UnknownHostException { Socket worker = null; //makes all the connections int Port =port; //make port InetAddress hostAddress; //stores the IP address of the target boolean status=false; String Host=host; hostAddress=InetAddress.getByName(Host); try { worker= new Socket(hostAddress,Port); status=true; } catch(java.io.IOException e) { status=false; } finally { try { worker.close(); } catch(java.io.IOException e){} catch(NullPointerException e){} } return status; }