protected static ByteBuffer toTCPBuffer(GelfMessage message, ThreadLocal<ByteBuffer> writeBuffers) {

        while (true) {

            try {
                return message.toTCPBuffer(getBuffer(writeBuffers));
            } catch (BufferOverflowException e) {
                enlargeBuffer(writeBuffers);
            }
        }
    }
protected static ByteBuffer toTCPBuffer ( GelfMessage message , ThreadLocal < ByteBuffer > writeBuffers ) { while ( true ) { try { return message . toTCPBuffer ( getBuffer ( writeBuffers ) ) ; } catch ( BufferOverflowException e ) { enlargeBuffer ( writeBuffers ) ; } } }
Create TCP buffer and apply auto-buffer-enlarging, if necessary.

@param message
@param writeBuffers
@return