/** * 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); }
/** * 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 protected Decoder getDecoder() throws IOException { return new ValidatingDecoder(schema, super.getDecoder()); } @Override
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); }
/** * 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); }
/** * 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); }