private void circularByteBufferInitializer ( int bufferCapacity , int bufferSize , int readPosition , int writePosition ) { if ( bufferCapacity < 2 ) { throw new IllegalArgumentException ( "Buffer capacity must be greater than 2 !" ) ; } if ( ( bufferSize < 0 ) || ( bufferSize > bufferCapacity ) ) { throw new IllegalArgumentException ( "Buffer size must be a value between 0 and " + bufferCapacity + " !" ) ; } if ( ( readPosition < 0 ) || ( readPosition > bufferSize ) ) { throw new IllegalArgumentException ( "Buffer read position must be a value between 0 and " + bufferSize + " !" ) ; } if ( ( writePosition < 0 ) || ( writePosition > bufferSize ) ) { throw new IllegalArgumentException ( "Buffer write position must be a value between 0 and " + bufferSize + " !" ) ; } this . buffer = new byte [ bufferCapacity ] ; this . currentBufferSize = bufferSize ; this . currentReadPosition = readPosition ; this . currentWritePosition = writePosition ; }
Intializes the new CircularByteBuffer with all parameters that characterize a CircularByteBuffer .