/** * Creates a {@link ValidatingDecoder} wrapping the Decoder provided. This * ValidatingDecoder will ensure that operations against it conform to the * schema provided. * * @param schema * The Schema to validate against. Cannot be null. * @param wrapped * The Decoder to wrap. * @return A ValidatingDecoder configured with <i>wrapped</i> and * <i>schema</i> * @throws IOException */ public ValidatingDecoder validatingDecoder(Schema schema, Decoder wrapped) throws IOException { return new ValidatingDecoder(schema, wrapped); }
@Override public void skipFixed(int length) throws IOException { checkFixed(length); in.skipFixed(length); }
ValidatingDecoder(Symbol root, Decoder in) throws IOException { super(root); this.configure(in); }
ValidatingDecoder(Schema schema, Decoder in) throws IOException { this(getSymbol(schema), in); }
ValidatingDecoder(Schema schema, Decoder in) throws IOException { this(getSymbol(schema), in); }
@Override public void skipFixed(int length) throws IOException { checkFixed(length); in.skipFixed(length); }
/** * Creates a {@link ValidatingDecoder} wrapping the Decoder provided. This * ValidatingDecoder will ensure that operations against it conform to the * schema provided. * * @param schema * The Schema to validate against. Cannot be null. * @param wrapped * The Decoder to wrap. * @return A ValidatingDecoder configured with <i>wrapped</i> and * <i>schema</i> * @throws IOException */ public ValidatingDecoder validatingDecoder(Schema schema, Decoder wrapped) throws IOException { return new ValidatingDecoder(schema, wrapped); }
ValidatingDecoder(Symbol root, Decoder in) throws IOException { super(root); this.configure(in); }
ValidatingDecoder(Schema schema, Decoder in) throws IOException { this(getSymbol(schema), in); }
@Override public void readFixed(byte[] bytes, int start, int len) throws IOException { checkFixed(len); in.readFixed(bytes, start, len); }
@Override protected Decoder getDecoder() throws IOException { return new ValidatingDecoder(schema, super.getDecoder()); } @Override
ValidatingDecoder(Symbol root, Decoder in) throws IOException { super(root); this.configure(in); }
ValidatingDecoder(Schema schema, Decoder in) throws IOException { this(getSymbol(schema), in); }
@Override public void readFixed(byte[] bytes, int start, int len) throws IOException { checkFixed(len); in.readFixed(bytes, start, len); }
private static void check(Schema sc, byte[] bytes, String calls, Object[] values, final int skipLevel, Encoding encoding) throws IOException { // dump(bytes); // System.out.println(new String(bytes, "UTF-8")); Decoder bvi = null; switch (encoding) { case BINARY: case BLOCKING_BINARY: bvi = DecoderFactory.get().binaryDecoder(bytes, null); break; case JSON: InputStream in = new ByteArrayInputStream(bytes); bvi = new JsonDecoder(sc, in); } Decoder vi = new ValidatingDecoder(sc, bvi); check(vi, calls, values, skipLevel); }
ValidatingDecoder(Symbol root, Decoder in) throws IOException { super(root); this.configure(in); }
@Override public void skipFixed(int length) throws IOException { checkFixed(length); in.skipFixed(length); }
/** * Creates a {@link ValidatingDecoder} wrapping the Decoder provided. This * ValidatingDecoder will ensure that operations against it conform to the * schema provided. * * @param schema * The Schema to validate against. Cannot be null. * @param wrapped * The Decoder to wrap. * @return A ValidatingDecoder configured with <i>wrapped</i> and * <i>schema</i> * @throws IOException */ public ValidatingDecoder validatingDecoder(Schema schema, Decoder wrapped) throws IOException { return new ValidatingDecoder(schema, wrapped); }
@Override public void skipFixed(int length) throws IOException { checkFixed(length); in.skipFixed(length); }
/** * Creates a {@link ValidatingDecoder} wrapping the Decoder provided. This * ValidatingDecoder will ensure that operations against it conform to the * schema provided. * * @param schema * The Schema to validate against. Cannot be null. * @param wrapped * The Decoder to wrap. * @return A ValidatingDecoder configured with <i>wrapped</i> and * <i>schema</i> * @throws IOException */ public ValidatingDecoder validatingDecoder(Schema schema, Decoder wrapped) throws IOException { return new ValidatingDecoder(schema, wrapped); }