CORE API / NOTES</>↗Core API13 Aug 2008
Java language which was there when the language was created. This multithreading capabilities can be said like running each program on their on CPU, although the machine only has a single CPU installed. To create a Thread program in Java we can extend the java.lang.Thread class and override the run() method. But as we know […]
CORE API / NOTES</>↗Core API13 Aug 2008
The code below demonstrates how to obtain file system root available on your system. In Linux, you will have a single root (/) while on Windows you could get C:\ or D:\ that represent the root drives. package org.kodejava.io; import java.io.File; public class FileSystemRoot { public static void main(String[] args) { // List the available […]
CORE API / NOTES</>↗Core API08 Aug 2008
package org.kodejava.io; import java.io.File; public class EmptyDirCheck { public static void main(String[] args) { File file = new File("D:/Downloads"); // Check to see if the object represent a directory. if (file.isDirectory()) { // Get list of file in the directory. When its length is not zero // the folder is not empty. String[] files = […]
TAGLIB / NOTES</>↗Taglib08 Aug 2008
This example show how to format date in JSP using format tag library. We create a date object using the <jsp:useBean> taglib. To format the date we use the <fmt:formatDate> taglib. We assign the value attribute to the date object, set the type attribute as date and define the pattern how the date will be […]
SECURITY / NOTES</>↗Security04 Aug 2008
package org.kodejava.security; import java.security.Provider; import java.security.Security; import java.util.Set; import java.util.HashSet; public class SecurityProvider { public static void main(String[] args) { // Create a set so that we can have a unique results. Set<String> results = new HashSet<>(); // Returns an array containing all the installed providers. Provider[] providers = Security.getProviders(); for (Provider provider : providers) […]
CORE API / NOTES</>↗Core API03 Aug 2008
On the previous example How do I encrypt an object with DES? we encrypt an object. In this example we will decrypt the stored object. package org.kodejava.crypto; import java.io.*; import javax.crypto.SecretKey; import javax.crypto.Cipher; import javax.crypto.SealedObject; public class ObjectDecrypt { public static void main(String[] args) throws Exception { // Read the previously stored SecretKey. SecretKey key […]