@@ -0,0 +1,2582 @@
+package com.xqbase.baiji.io;%0A%0Aimport com.xqbase.baiji.schema.Schema;%0A%0Aimport java.io.IOException;%0A%0A/**%0A * A factory for creating and configuring %7B@link Decoder%7Ds.%0A * %3Cp/%3E%0A * Factories are thread-safe, and are generally cached by applications for%0A * performance reasons. Multiple instances are only required if multiple%0A * concurrent configurations are needed.%0A *%0A * @see Decoder%0A */%0Apublic class DecoderFactory %7B%0A%0A    private static final DecoderFactory DECODER_FACTORY = new DefaultDecoderFactory();%0A    private static final int DEFAULT_BUFFER_SIZE = 8192;%0A%0A    private int binaryDecoderBufferSize = DEFAULT_BUFFER_SIZE;%0A%0A    public DecoderFactory get() %7B%0A        return DECODER_FACTORY;%0A    %7D%0A%0A    /**%0A     * Configures this factory to use the specified buffer size when creating%0A     * Decoder instances that buffer their input. The default buffer size is%0A     * 8192 bytes.%0A     *%0A     * @param size The preferred buffer size. Valid values are in the range %5B32,%0A     *          16*1024*1024%5D. Values outside this range are rounded to the nearest%0A     *          value in the range. Values less than 512 or greater than 1024*1024%0A     *          are not recommended.%0A     * @return This factory, to enable method chaining:%0A     * %3Cpre%3E%0A     * DecoderFactory myFactory = new DecoderFactory().useBinaryDecoderBufferSize(4096);%0A     * %3C/pre%3E%0A     */%0A    public DecoderFactory configureDecoderBufferSize(int size) %7B%0A        if (size %3C 32)%0A            size = 32;%0A        if (size %3E 16 * 1024 * 1024)%0A            size = 16 * 1024 * 1024;%0A        this.binaryDecoderBufferSize = size;%0A        return this;%0A    %7D%0A%0A    /**%0A     * Creates a %7B@link ResolvingDecoder%7D wrapping the Decoder provided. This%0A     * ResolvingDecoder will resolve input conforming to the %3Ci%3Ewriter%3C/i%3E schema%0A     * from the wrapped Decoder, and present it as the %3Ci%3Ereader%3C/i%3E schema.%0A     *%0A     * @param schema%0A     *          The Schema that the source data is in. Cannot be null.%0A     * @param wrapped%0A     *          The Decoder to wrap.%0A     * @return A ResolvingDecoder configured to resolve %3Ci%3Ewriter%3C/i%3E to%0A     *         %3Ci%3Ereader%3C/i%3E from %3Ci%3Ein%3C/i%3E%0A     * @throws IOException%0A     */%0A    public ResolvingDecoder resolvingDecoder(Schema schema, Decoder wrapped) throws IOException %7B%0A        return new ResolvingDecoder(schema, wrapped);%0A    %7D%0A%0A    private static class DefaultDecoderFactory extends DecoderFactory %7B%0A        @Override%0A        public DecoderFactory configureDecoderBufferSize(int size) %7B%0A            throw new IllegalStateException(%22This factory instance is immutable%22);%0A        %7D%0A    %7D%0A%7D%0A

add the DecoderFactory...