0 Replies Latest reply on Mar 1, 2004 9:03 AM by Thiago Gozzi Prado

    Problem reading resource as stream

    Thiago Gozzi Prado Newbie

      Hi all,

      I have this method:

       public byte[] getBytes(long start, long end)
       throws IOException {
      
       byte[] bytes;
       ByteArrayInputStream byteInput;
       InputStream resource;
       int len;
      
       resource = MyClass.class.getClassLoader()
       .getResourceAsStream("file.txt");
       resource.skip(start);
       len = (int) (end - start + 1);
       bytes = new byte[len];
       resource.read(bytes);
      
       return bytes;
       }
      


      When I call getBytes(0, 2999) outside the JBoss, there's no problem, but when I make the same call within the JBoss, I get a byte array with '\u0000' value after the 2299th element.

      Any idea?

      file.txt has 42 KB and I'm using jboss-3.0.4_tomcat-4.0.6.

      Thanks,
      Thiago.