Samir you can take advantage of the skip method of InputStreamReader class to skip reading the specified number of bytes at any place in a file or any other sink.
Here is a sample program in which i will skip reading bytes in the middle of the file.
Would u tell me the what program u are developing & y u need this functioanlity. I know how to do this but i havent yet used it practically anywhere.
<code>
import java.io.*;
class SkipBytes
{
public static void main(
String args[]) throws IOException
{
InputStream byteSkipper = new FileInputStream("c:autoexec.bat");
int size = byteSkipper.available();
System.out.println("Total number of bytes to read " + size);
int n = size/40 ;
System.out.println("Reading " + n + " bytes");
for(int i=0;i<n;i++)>
{
System.out.print((char)byteSkipper.read());
}
System.out.println(" ");
n = size/20;
System.out.println("Skipping next " + n + " bytes " );
byteSkipper.skip(n);
System.out.println("Reading remaining bytes ");
n = size/40;
for(int i=0;i<n;i++)>
{
System.out.print((char)byteSkipper.read());
}
}
}
</code>
------------------
Sayal