public long[] readLongArray(final int items,final JBBPByteOrder byteOrder) throws IOException {
  int pos=0;
  if (items < 0) {
    long[] buffer=new long[INITIAL_ARRAY_BUFFER_SIZE];
    while (hasAvailableData()) {
      final long next=readLong(byteOrder);
      if (buffer.length == pos) {
        final long[] newbuffer=new long[buffer.length << 1];
        System.arraycopy(buffer,0,newbuffer,0,buffer.length);
        buffer=newbuffer;
      }
      buffer[pos++]=next;
    }
    if (buffer.length == pos) {
      return buffer;
    }
    final long[] result=new long[pos];
    System.arraycopy(buffer,0,result,0,pos);
    return result;
  }
 else {
    final long[] buffer=new long[items];
    for (int i=0; i < items; i++) {
      buffer[i]=readLong(byteOrder);
    }
    return buffer;
  }
}

public long [ ] readLongArray ( final int items , final JBBPByteOrder byteOrder ) throws IOException { int pos = 0 ; if ( items < 0 ) { long [ ] buffer = new long [ INITIAL_ARRAY_BUFFER_SIZE ] ; while ( hasAvailableData ( ) ) { final long next = readLong ( byteOrder ) ; if ( buffer . length == pos ) { final long [ ] newbuffer = new long [ buffer . length << 1 ] ; System . arraycopy ( buffer , 0 , newbuffer , 0 , buffer . length ) ; buffer = newbuffer ; } buffer [ pos ++ ] = next ; } if ( buffer . length == pos ) { return buffer ; } final long [ ] result = new long [ pos ] ; System . arraycopy ( buffer , 0 , result , 0 , pos ) ; return result ; } else { final long [ ] buffer = new long [ items ] ; for ( int i = 0 ; i < items ; i ++ ) { buffer [ i ] = readLong ( byteOrder ) ; } return buffer ; } }
read number of long items from the input stream .
