| ambika 2004-03-28, 12:01 am |
| Hello everyone,
Am having a small problem in reading from a
jar file.The size of the jar file is 611 bytes.When I try to read the
jar file using FileInputStream alone i get some value for j but when
I use it along with JarInputStream and check the value of j it is
-1.The FileInputStream is working very differently here.Can anyone
tell me why?
FileInputStream works just fine in the code below;
import java.util.jar.*;
import java.io.*;
class jartry
{
public static void main(String args[])throws Exception
{
FileInputStream fis=new FileInputStream("result.jar");
int j;
j=fis.read();
System.out.println("value of fis:"+j);
}
}
Can anyone tell me how does the code below give an answer of -1 for
j???
import java.util.jar.*;
import java.io.*;
class jartry
{
public static void main(String args[])throws Exception
{
FileInputStream fis=new FileInputStream("result.jar");
JarInputStream jis=new JarInputStream(fis);
int j,i;
j=fis.read();
i=jis.read();
System.out.println("value of fis:"+j);
System.out.println("value of jis:"+i);
}
}
Thank You
ambika...
|