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

    ArrayindexOutofbound in a datainputstream Read

      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?


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