Java Tutorials

181. BufferedInputStream - sample program in Java

By: Daniel Malcolm : 2007-09-14

Description: Buffering I/O is a very common performance optimization. Java's BufferedInputStream class allows you to "wrap" any InputStream into a buffered stream and achieve this performance improvement.


182. ByteArrayOutputStream - sample program in Java

By: Charles : 2007-09-14

Description: ByteArrayOutputStream is an implementation of an output stream that uses a byte array as the destination. ByteArrayOutputStream has two constructors, shown here:


183. ByteArrayInputStream - sample program in Java

By: Baski : 2007-09-14

Description: ByteArrayInputStream is an implementation of an input stream that uses a byte array as the source. This class has two constructors, each of which requires a byte array to provide the data source:


184. FileOutputStream - sample program in Java

By: Abinaya : 2007-09-14

Description: FileOutputStream creates an OutputStream that you can use to write bytes to a file. Its most commonly used constructors are shown here:


185. FileInputStream - sample program in Java

By: Sam Chen : 2007-09-14

Description: The FileInputStream class creates an InputStream that you can use to read bytes from


186. FilenameFilter - sample program in Java

By: Reema sen : 2007-09-14

Description: You will often want to limit the number of files returned by the list() method to include only those files that match a certain filename pattern, or filter. To do this, you must use a second form of list(), shown here:


187. list() contents of a Directory - sample program in Java

By: Priya : 2007-09-14

Description: A directory is a File that contains a list of other files and directories. When you create a File object and it is a directory, the isDirectory() method will return true. In this case, you can call list() on that object to extract the list of other files and directories inside. It has two forms. The first is shown here:


188. File example program in Java

By: Priya : 2007-09-14

Description: Although most of the classes defined by java.io operate on streams, the File class does not. It deals directly with files and the file system. That is, the File class does not specify how information is retrieved from or stored in files; it describes the properties of a file itself. A File object is used to obtain or manipulate the information associated with a disk file, such as the permissions, time, date, and directory path, and to navigate subdirectory hierarchies.


189. Random class sample program in Java - nextGaussian(), nextBoolean(), nextBytes(), nextInt(), nextLong(), nextFloat(), nextDouble()

By: Manoj Kumar : 2007-09-14

Description: The Random class is a generator of pseudorandom numbers. These are called pseudorandom numbers because they are simply uniformly distributed sequences. Random defines the following constructors:


190. Calendar - sample program in Java

By: Lakshmi : 2007-09-14

Description: The abstract Calendar class provides a set of methods that allows you to convert a time in milliseconds to a number of useful components. Some examples of the type of information that can be provided are: year, month, day, hour, minute, and second. It is intended that subclasses of Calendar will provide the specific functionality to interpret time information according to their own rules. This is one aspect of the Java class library that enables you to write programs that can operate in several international environments. An example of such a subclass is GregorianCalendar.