Author Archives | Mohamed Sanaulla

About Mohamed Sanaulla In his day job he works on developing enterprise applications using ADF. He is also the moderator of JavaRanch forums and an avid blogger. ( subscribe )

How to create bounded taskflows in ADF using JDeveloper?

November 7, 2012

0 Comments

Taskflows are a very useful feature in Oracle ADF which provide a modular approach for defining control flow in an application. It allows to create application flow graphs which can be tied together to build the complete application. So instead of considering an application as a collection of different JSF pages, in ADF we would [...]

email

Book Review: Pro Java 7 NIO.2

August 23, 2012

1 Comment

The Pro Java 7 NIO.2 book is all about the latest enhancements to the File NIO APIs added as part of Java 7. The book covers New Path and Paths API: A brief overview of the Path and Paths classes and how these can be used to represent a file/directory. Also explained are the different [...]

Reading file asynchronously in Java

August 22, 2012

2 Comments

We all are familiar with reading/writing file in a synchronous way. In Java 7 a new API was added to read/write the contents of the file asynchronously. The API is AsynchronousFileChannel. In this example lets look at how to read the contents of the file asynchronously. There are two approaches to read the contents asynchronously: [...]

How to use Socket API for creating Client-Server application in Java

August 20, 2012

1 Comment

In this example we make use of ServerSocketChannel and SocketChannel to create a simple Echo application where in the Server would print the data sent by the client. The code is explained with the required comments: and the client which connects to the server is:

How to use ByteBuffer in Java?

August 7, 2012

2 Comments

ByteBuffer API has been in Java since 1.4. The name itself suggests that these contain bytes of data. The data to be stored in the buffer can be Integer (int, long), Characters (char), Floating value (double), all these are converted into bytes before being stored in the buffer array. ByteBuffer can be of two types- [...]

Lazy Initialization, Singleton Pattern and Double Checked locking

July 24, 2012

1 Comment

Lazy Initialization Lazy Initialization is a technique where one postpones the instantiation of a object until its first use. In other words the instance of a class is created when its required to be used for the first time. The idea behind this is to avoid unnecessary instance creation. But there are concerns related to [...]

Visiting all the files and directories for a directory in Java using NIO2

July 22, 2012

1 Comment

At times we might want to search for some file in a directory traversing recursively into other directories with in that directory, I know getting the recursive program right at the first time is always a challenge. Or we might want to list all the contents of a directory. For all these operations the NIO2 [...]

Listing and filtering directory content using Java NIO2

July 20, 2012

1 Comment

The Files class provides a method- newDirectoryStream to get the Directory contents for a give path instance. There are other overloaded versions of newDirectoryStream method which take in filters to apply on the directory content. Listing all files in the directory Using Files.newDirectoryStream method gives an instance of DirectoryStream class which is a Iterable i.e [...]

Playing with reduceLeft, reduceRight, foldLeft, foldRight API in Scala

July 18, 2012

3 Comments

In our previous post we saw in detail about the foreach. map, flatMap and collect methods in the Iterable trait. In this post we will look into detail about reduceLeft, reduceRight, foldLeft, foldRight methods of the Iterable trait. These methods are almost similar in the way the operate on the collection so it should be [...]

Creating Hard links and Soft links for a file in Java

July 17, 2012

2 Comments

We have been exploring the NIO enhancements in Java 7 and in this post I will explain about creating links- Hard links and Soft links in Java. And this feature is part of Java 7. A link is kind of substitute name to access a particular file/directory, something like an alias to the file/directory. This [...]