public String [ ] readStringArray ( final int items , final JBBPByteOrder byteOrder ) throws IOException { int pos = 0 ; if ( items < 0 ) { String [ ] buffer = new String [ INITIAL_ARRAY_BUFFER_SIZE ] ; // till end while ( hasAvailableData ( ) ) { final String next = readString ( byteOrder ) ; if ( buffer . length == pos ) { final String [ ] newbuffer = new String [ buffer . length << 1 ] ; System . arraycopy ( buffer , 0 , newbuffer , 0 , buffer . length ) ; buffer = newbuffer ; } buffer [ pos ++ ] = next ; } if ( buffer . length == pos ) { return buffer ; } final String [ ] result = new String [ pos ] ; System . arraycopy ( buffer , 0 , result , 0 , pos ) ; return result ; } else { // number final String [ ] buffer = new String [ items ] ; for ( int i = 0 ; i < items ; i ++ ) { buffer [ i ] = readString ( byteOrder ) ; } return buffer ; } }
Read array of srings from stream .