Home » Core Java » apache » Page 3

apache

org.apache.commons.codec.binary.base64 Example

Base64 class is used for  Base64 encoding and decoding as defined by RFC 2045.  There are various constructors with  URL-Safe mode, Line Length and Line Separator parameters. The URL Safe parameter is used to encode operations. Decoding handles URL safe mode on and off.  Bytestreams are used directly by Base64 class. Character streams are not used. ThreadSafe Base64 class has ...

Read More »

org.apache.commons.dbcp2.BasicDataSource Example

In this example we shall show you how to make use of BasicDataSource class of Apache Commons DBCP. Nowadays, many web applications interacts with a relational database, Creating a new connection for each user can be time consuming (often requiring multiple seconds of clock time), in order to perform a database transaction that might take milliseconds. Opening a connection per ...

Read More »

java.net.URLConnection Example

URLConnection class is used for accessing the attributes of a remote resource. It represents a communication link between the URL and the application.This class can be used to read and write data to resource provided by the URL. URLConnection has subclasses HttpURLConnection which has support for HTTP-specific features and JarURLConnection which has support for JAR-specific features. In this example we ...

Read More »

org.apache.commons.dbcp2.PoolableConnection Example

In this post we learn how to use a connection’s pool using the apache commons dbcp2 framework. A connection pool is an object that maintains a pool of opened connections so the application can simply grab one when it needs to, use it, and then hand it back, eliminating much of the long wait of the creation of connections. 1. ...

Read More »

org.apache.commons.beanutils.converters.ArrayConverter Example

This article introduces the ArrayConverter class of the org.apache.commons.beanutils.converters package and its basic usage. This is defined in the Apache Commons BeanUtils 1.9.2 API. ArrayConverter is generic Converter implementation that handles conversion to and from array objects. The main features of this implementation are to convert: Individual elements of an array by delegating to a converter of appropriate type. From ...

Read More »

org.apache.commons.cli.BasicParser Example

Basic Parser is for Command Line Processing. Command Line Processing has three stages definition, parsing and interrogation. Options are defined for command line processing. Command Line interface uses the options class as a container for option instances. To create options, there are two ways. The constructors and factory methods defined in options are the two methods of creating optios. Definition ...

Read More »

org.apache.commons.io.comparator.DirectoryFileComparator Example

Apache Commons IO is a library of utilities to assist with developing IO functionality. org.apache.commons.io.comparator package provides various Comparator implementations for Files. DirectoryFileComparator is one of the classes. This class can be used to sort lists or arrays of files (File objects) by directories and files. The File class’s isDirectory() method is used for comparing two files. This article shows ...

Read More »

org.apache.commons.io.comparator.LastModifiedFileComparator Example

Apache Commons IO is a library of utilities to assist with developing IO functionality. org.apache.commons.io.comparator package provides various Comparator implementations for Files. LastModifiedFileComparator is one of the classes. This class can be used to sort lists or arrays of files (File objects) by their last modified date/time. The File class’s lastModified() method is used for comparing two files; the method ...

Read More »

org.apache.commons.lang3.math.Fraction Example

Hi folks, Today we are going to talk about Fractions from org.apache.commons.lang3.math package. This api provides us with capabilities to handle operations on fractions. I wrote a nice and simple java program demonstrating the application of this api. If you are already a java programmer and if you have tried dividing two numbers with different datatypes, you would have encountered ...

Read More »

org.apache.commons.io.comparator.NameFileComparator Example

Apache Commons IO is a library of utilities to assist with developing IO functionality. org.apache.commons.io.comparator package provides various Comparator implementations for Files. NameFileComparator is one of the classes. This class can be used to sort lists or arrays of files (File objects) by their name. The File class’s getName() method is used for comparing two files; the method returns the ...

Read More »