Java Code Example for BufferedInputStream : markSupported() Method

Java Code Example for BufferedInputStream : markSupported() Method
DeeKay March 29, 2011 at 12:14 am · java.io

Tests if this input stream supports the mark and reset methods. The markSupported method of BufferedInputStream returns true. Below is the code example for BufferedInputStream markSupported() method –


Java Code Example for BufferedInputStream : mark() method

Java Code Example for BufferedInputStream : mark() method
DeeKay March 28, 2011 at 8:53 pm · java.io

BufferedInputStream mark() method marks the current position in this input stream. A subsequent call to the reset method repositions this stream at the last marked position so that subsequent reads re-read the same bytes. The readlimit argument tells this input stream to allow that many bytes to be read before the mark position gets invalidated….
Continue Reading »


Java Code for BufferedInputStream : reset() Method Example

Java Code for BufferedInputStream : reset() Method Example
DeeKay March 28, 2011 at 8:31 pm · java.io

BufferedInputStream reset() method repositions the current stream to the position at the time the mark method was called last time on this input stream. If markpos is -1 (no mark has been set or the mark has been invalidated), an IOException is thrown. Otherwise, pos is set equal to markpos. Overrides: reset in class FilterInputStream…
Continue Reading »


Java Code Example for BufferedInputStream: skip() method

Java Code Example for BufferedInputStream: skip() method
DeeKay March 22, 2011 at 12:34 am · java.io

skip() method of BufferedInputStream class creates a byte array and then repeatedly reads into it until n bytes have been read or the end of the stream has been reached. Skips over and discards n bytes of data from this input stream. The skip method may, for a variety of reasons, end up skipping over…
Continue Reading »


Java Code Example for BufferedInputStream: close() method

Java Code Example for BufferedInputStream: close() method
DeeKay March 21, 2011 at 11:13 pm · java.io

close() method of BufferedInputStream closes the current input stream and releases any system resources associated with the stream. Once the stream has been closed, further read(), available(), reset(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect.


Java Code Example for BufferedInputStream: read(byte[] b,int off,int len) Method

Java Code Example for BufferedInputStream: read(byte[] b,int off,int len) Method
DeeKay March 21, 2011 at 6:23 pm · java.io

Reads bytes from this byte-input stream into the specified byte array, starting at the given offset. It attempts to read as many bytes as possible by repeatedly invoking the read method of the underlying stream. This iterated read continues until one of the following conditions becomes true: The specified number of bytes have been read,…
Continue Reading »


Java Code Example for BufferedInputStream: read() Method

Java Code Example for BufferedInputStream: read() Method
DeeKay March 21, 2011 at 6:11 pm · java.io

read() method of BufferedInputStream class reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the…
Continue Reading »


Java Code Example for BufferedInputStream to read file

Java Code Example for BufferedInputStream to read file
DeeKay March 21, 2011 at 4:29 pm · java.io

BufferedInputStream adds an additionally capability to InputStream by buffering the input. When instance of BufferedInputStream is created, an internal array is created to buffer the input data. As bytes from stream are read or skipped, the internal buffer is refilled as necessary from the contained input stream, many bytes at a time. BufferedInputStream class has…
Continue Reading »


Code Example for BufferedInputStream: available() method

Code Example for BufferedInputStream: available() method
DeeKay March 21, 2011 at 3:53 pm · java.io

BufferedInputStream available() method returns the total count of bytes that can be read or skipped over from the input stream without blocking by next invocation of a method for the input stream. The next invocation might be the same thread or another thread. A single read or skip of this many bytes will not block,…
Continue Reading »


Aspect-Oriented Modeling – Google Tech Talk (Video)

Aspect-Oriented Modeling – Google Tech Talk (Video)
DeeKay February 2, 2011 at 1:54 am · Java/J2EE, Programming

In software engineering, aspects are concerns that cut across multiple modules. They can lead to the common problems of concern tangling and scattering: concern tangling is where software concerns are not represented independently of each other; concern scattering is where a software concern is represented in multiple remote places in a software artifact. Although aspect-oriented…
Continue Reading »


How to insert XMLType column value in oracle10g using JDBC driver?

How to insert XMLType column value in oracle10g using JDBC driver?
DeeKay November 16, 2010 at 9:54 pm · Database, How To, Java/J2EE, Tutorial

Recently while working on the client project, i can came across a situation where i have to insert the XML file as XMLType datatype in Oracle 10g table. I was trying to insert the XML file as CLOB object, but it was giving me some Exception. I tried below options for this Inserting the XML…
Continue Reading »


Java Program For Uploading File To SFTP Server using JSch SFTP Put

Java Program For Uploading File To SFTP Server using JSch SFTP Put
DeeKay July 1, 2010 at 1:36 am · Java/J2EE, Open Source, SFTP

Uploading the file to SFTP server is not easy using Java.net API or Apache‘s Commons.net API. Many of you have faced lots of problems using these API. To upload the file SFTP server you have use the JSCH SFTP API, you can download the API from here. In my previous post i have shown how to…
Continue Reading »


Java program for Downloading File from SFTP server

Java program for Downloading File from SFTP server
DeeKay June 29, 2010 at 4:54 am · Java/J2EE, Open Source, SFTP

Most of the people face problem to download the file from the SFTP server. Everybody thinks it will be same as FTP in java but its not so. If you are using the Apache Commons.net API then you will find below classes for FTP/FTPS but there is no class available for SFTP FTPClient FTPSClient Let…
Continue Reading »


How to Perform dynamic load balancing in Glassfish application server?

How to Perform dynamic load balancing in Glassfish application server?
DeeKay June 12, 2010 at 4:23 am · Java/J2EE, Open Source

GlassFish is a fully Java EE 5-compliant application server with enterprise-ready features available under two OSI-approved licenses. Among many other enterprise-level features, GlassFish provides a very good self-management functionality extendable using the Java Management eXtension (JMX) standard.The GlassFish application server provides good facilities for cluster management and load balancing. Still, sometimes we need to have…
Continue Reading »


EARs, WARs, JARs, and Java EE

EARs, WARs, JARs, and Java EE
DeeKay June 12, 2010 at 4:01 am · Java/J2EE

A Java EE application may contain one or more Java EE components such as EJBs, Web modules, resource adapters, or J2EE application client modules. Each Java EE component can have an associated deployment descriptor — an XML file that describes the component. Java enterprise components are deployed using the Java Archive (JAR) file format, which…
Continue Reading »


Servlet and JSP performance tuning

Servlet and JSP performance tuning
DeeKay June 12, 2010 at 3:23 am · Java/J2EE

This article describes performance-tuning techniques (PTT) for developing high performance and scalable JSP (JavaServer Pages) pages and servlets. That means building applications that are reasonably and consistently fast, and can scale up to the increasing number of users and/or requests. In this article, I walk you through the practical and proven performance-tuning techniques that will…
Continue Reading »


Testing Your Java Code

Testing Your Java Code
DeeKay June 12, 2010 at 2:55 am · Java/J2EE

It cannot be said enough that testing is the most important part of the development cycle. Even though I am not a tester (and not trying to push an agenda), I have seen that well written code without adequate test cases is not really something that any developer or team should strive for. And in…
Continue Reading »


Spaghetti Code

Spaghetti Code
DeeKay June 12, 2010 at 2:52 am · Java/J2EE, Open Source

One always guesses every one knows what a Spaghetti code is – a code which is hard to understand and maintain, a code which everyone is so scared to touch that bug fixes are always quick and dirty, and which makes code further spaghettier. I wonder has anyone thought about spaghetti products. It may not…
Continue Reading »


Hibernate or iBatis or both ? Which is better?

Hibernate or iBatis or both ? Which is better?
DeeKay June 5, 2010 at 1:58 am · Database, Java/J2EE, Open Source

What’s really difference between two and really more importantly when should I use one over the other. Its pretty interesting question because there are major differences between iBatis and Hibernate. Within in the java persistence there is no one size, fits all solution. So, in this case Hibernate which is a de facto standard is…
Continue Reading »


What is the difference between an application server and a Web server?

What is the difference between an application server and a Web server?
DeeKay April 21, 2010 at 3:33 am · Java/J2EE

What is the difference between an application server and a Web server? Taking a big step back, a Web server serves pages for viewing in a Web browser, while an application server provides methods that client applications can call. A little more precisely, you can say that: A Web server exclusively handles HTTP requests, whereas…
Continue Reading »