/** * Dynamically sets a new delimiter. Next time * {@link #decodeFully(IoBuffer)} will be called it will use the new * delimiter. Delimiter matching is reset only if <tt>resetMatchCount</tt> is true but * decoding will continue from current position. * * NB : Delimiter {@link LineDelimiter#AUTO} is not allowed. * * @param delim the new delimiter as a byte array * @param resetMatchCount delimiter matching is reset if true */ public void setDelimiter(byte[] delim, boolean resetMatchCount) { if (delim == null) { throw new IllegalArgumentException("Null delimiter not allowed"); } // Convert delimiter to IoBuffer. IoBuffer delimiter = IoBuffer.allocate(delim.length); delimiter.put(delim); delimiter.flip(); ctx.setDelimiter(delimiter); ctx.setContentLength(-1); if (resetMatchCount) { ctx.setMatchCount(0); } }
/** * Dynamically sets a new delimiter. Next time * {@link IoBufferDecoder#decodeOnce(IoSession, int) } will be called it will use the new * delimiter. Delimiter matching is reset only if <tt>resetMatchCount</tt> is true but * decoding will continue from current position. * * NB : Delimiter {@link LineDelimiter#AUTO} is not allowed. * * @param delim the new delimiter as a byte array * @param resetMatchCount delimiter matching is reset if true */ public void setDelimiter(byte[] delim, boolean resetMatchCount) { if (delim == null) { throw new NullPointerException("Null delimiter not allowed"); } // Convert delimiter to IoBuffer. IoBuffer delimiter = IoBuffer.allocate(delim.length); delimiter.put(delim); delimiter.flip(); ctx.setDelimiter(delimiter); ctx.setContentLength(-1); if (resetMatchCount) { ctx.setMatchCount(0); } }
/** * Dynamically sets a new delimiter. Next time * {@link #decodeFully(IoBuffer)} will be called it will use the new * delimiter. Delimiter matching is reset only if <tt>resetMatchCount</tt> is true but * decoding will continue from current position. * * NB : Delimiter {@link LineDelimiter#AUTO} is not allowed. * * @param delim the new delimiter as a byte array * @param resetMatchCount delimiter matching is reset if true */ public void setDelimiter(byte[] delim, boolean resetMatchCount) { if (delim == null) { throw new IllegalArgumentException("Null delimiter not allowed"); } // Convert delimiter to IoBuffer. IoBuffer delimiter = IoBuffer.allocate(delim.length); delimiter.put(delim); delimiter.flip(); ctx.setDelimiter(delimiter); ctx.setContentLength(-1); if (resetMatchCount) { ctx.setMatchCount(0); } }