// 
// Decompiled by Procyon v0.6.0
// 

package io.netty.handler.codec.http;

import io.netty.util.internal.ObjectUtil;

public final class HttpDecoderConfig implements Cloneable
{
    private int maxChunkSize;
    private boolean chunkedSupported;
    private boolean allowPartialChunks;
    private HttpHeadersFactory headersFactory;
    private HttpHeadersFactory trailersFactory;
    private boolean allowDuplicateContentLengths;
    private int maxInitialLineLength;
    private int maxHeaderSize;
    private int initialBufferSize;
    private boolean strictLineParsing;
    
    public HttpDecoderConfig() {
        this.maxChunkSize = 8192;
        this.chunkedSupported = true;
        this.allowPartialChunks = true;
        this.headersFactory = DefaultHttpHeadersFactory.headersFactory();
        this.trailersFactory = DefaultHttpHeadersFactory.trailersFactory();
        this.allowDuplicateContentLengths = false;
        this.maxInitialLineLength = 4096;
        this.maxHeaderSize = 8192;
        this.initialBufferSize = 128;
        this.strictLineParsing = HttpObjectDecoder.DEFAULT_STRICT_LINE_PARSING;
    }
    
    public int getInitialBufferSize() {
        return this.initialBufferSize;
    }
    
    public HttpDecoderConfig setInitialBufferSize(final int initialBufferSize) {
        ObjectUtil.checkPositive(initialBufferSize, "initialBufferSize");
        this.initialBufferSize = initialBufferSize;
        return this;
    }
    
    public int getMaxInitialLineLength() {
        return this.maxInitialLineLength;
    }
    
    public HttpDecoderConfig setMaxInitialLineLength(final int maxInitialLineLength) {
        ObjectUtil.checkPositive(maxInitialLineLength, "maxInitialLineLength");
        this.maxInitialLineLength = maxInitialLineLength;
        return this;
    }
    
    public int getMaxHeaderSize() {
        return this.maxHeaderSize;
    }
    
    public HttpDecoderConfig setMaxHeaderSize(final int maxHeaderSize) {
        ObjectUtil.checkPositive(maxHeaderSize, "maxHeaderSize");
        this.maxHeaderSize = maxHeaderSize;
        return this;
    }
    
    public int getMaxChunkSize() {
        return this.maxChunkSize;
    }
    
    public HttpDecoderConfig setMaxChunkSize(final int maxChunkSize) {
        ObjectUtil.checkPositive(maxChunkSize, "maxChunkSize");
        this.maxChunkSize = maxChunkSize;
        return this;
    }
    
    public boolean isChunkedSupported() {
        return this.chunkedSupported;
    }
    
    public HttpDecoderConfig setChunkedSupported(final boolean chunkedSupported) {
        this.chunkedSupported = chunkedSupported;
        return this;
    }
    
    public boolean isAllowPartialChunks() {
        return this.allowPartialChunks;
    }
    
    public HttpDecoderConfig setAllowPartialChunks(final boolean allowPartialChunks) {
        this.allowPartialChunks = allowPartialChunks;
        return this;
    }
    
    public HttpHeadersFactory getHeadersFactory() {
        return this.headersFactory;
    }
    
    public HttpDecoderConfig setHeadersFactory(final HttpHeadersFactory headersFactory) {
        ObjectUtil.checkNotNull(headersFactory, "headersFactory");
        this.headersFactory = headersFactory;
        return this;
    }
    
    public boolean isAllowDuplicateContentLengths() {
        return this.allowDuplicateContentLengths;
    }
    
    public HttpDecoderConfig setAllowDuplicateContentLengths(final boolean allowDuplicateContentLengths) {
        this.allowDuplicateContentLengths = allowDuplicateContentLengths;
        return this;
    }
    
    public HttpDecoderConfig setValidateHeaders(final boolean validateHeaders) {
        final DefaultHttpHeadersFactory noValidation = DefaultHttpHeadersFactory.headersFactory().withValidation(false);
        this.headersFactory = (validateHeaders ? DefaultHttpHeadersFactory.headersFactory() : noValidation);
        this.trailersFactory = (validateHeaders ? DefaultHttpHeadersFactory.trailersFactory() : noValidation);
        return this;
    }
    
    public HttpHeadersFactory getTrailersFactory() {
        return this.trailersFactory;
    }
    
    public HttpDecoderConfig setTrailersFactory(final HttpHeadersFactory trailersFactory) {
        ObjectUtil.checkNotNull(trailersFactory, "trailersFactory");
        this.trailersFactory = trailersFactory;
        return this;
    }
    
    public boolean isStrictLineParsing() {
        return this.strictLineParsing;
    }
    
    public HttpDecoderConfig setStrictLineParsing(final boolean strictLineParsing) {
        this.strictLineParsing = strictLineParsing;
        return this;
    }
    
    public HttpDecoderConfig clone() {
        try {
            return (HttpDecoderConfig)super.clone();
        }
        catch (final CloneNotSupportedException e) {
            throw new AssertionError();
        }
    }
}
