8 Replies Latest reply: Apr 2, 2008 5:38 AM by 800323 RSS

    ArrayindexOutofbound in a datainputstream Read

    807591
      Hi all,

      I am getting an arraybounds exception when I call the following methods, the position value is 1 and the length value is 1, but when I do dis.read(carrier, position, length); I get an exception. dis is a datainputstream, any ideas?

      Thanks
      Adam

      <code>
           public static byte[] getByte(File searchable, int position, int length){
                
                byte[] carrier = new byte[length];
                try {
                     dis.read(carrier, position, length);
                } catch (IOException e) {
                     e.printStackTrace();
                }
                return carrier;
           }
      </code>