private static byte[] readBytes(InputStream source,int length) throws IOException {
  byte[] result=new byte[length];
  for (int i=0; i < length; i++) {
    int bytik=source.read();
    if (bytik == -1) {
      return null;
    }
    result[i]=(byte)bytik;
  }
  return result;
}

private static byte [ ] readBytes ( InputStream source , int length ) throws IOException { byte [ ] result = new byte [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { int bytik = source . read ( ) ; if ( bytik == - 1 ) { return null ; } result [ i ] = ( byte ) bytik ; } return result ; }
reads the data of specified length from source and returns it as an array .
