Friday, August 14, 2009

String Builder Class

The thread safe StringBuffer class has a replacement in the form of StringBuilder .It doesnot have synchronized methods so it works much faster .So if you are performing a number of string operations in a single thread you will gain a tremendous performance while using this class .The string builder class consist of mutable sequence of charecters
.It provides an API ,which is compatible with StringBuffer,but there is no guarntee of its sychronization.This class is designed in such a way that it can be used as a drop in replacement
for StringBuffer in places

Thursday, August 13, 2009

Process Builder

An operating system process is created by using this class.A collection of process attributes is managed by ProcessBuilder instance.By using those attributes,the start() method creates a new process instance.To create a new subprocess with identical/related attributes the start method can be invoked from the same instance.
These process attributes are managed by each process builder in the following way:
Command: Command consist of a list of strings which makes the external program file to be invoked and its argument,if any significant.The String list representing a valid operating system is System dependent.

Environment:
A mapping which is System dependant varying from variables to values.The copy of the enviornment of the current process is the initial value.

Working Directory:
The current working directory of the current process is the default valueusually the system property,user.dir,imparts the name of the directory

RedirectErrorStream property:

At initial stage the standard output and error output of a subprocess are sent to two separate streams,meaning that this property is false.The false property can be accessed using two of the methods

--Process.getInputStream()

--Process.getErrorStream()