@Test public void output() throws Exception { MockFormat format = format(1); int[][] data = { { 100 } }; ByteArrayOutputStream output = new ByteArrayOutputStream(); try (ModelOutput<int[]> out = format.createOutput(int[].class, "dummy", output)) { dump(out, data); } assertThat(deserialize(output.toByteArray()), is(data)); }
@Override public ModelOutput<T> createOutput( Class<? extends T> dataType, String path, OutputStream stream) throws IOException, InterruptedException { JsonFormat<T> format = getJsonFormat(); Set<OutputOption> options = OUTPUT_OPTS; OutputStream destination = decorate(stream); return new DecoratedOutput(format.open(path, destination, options), new StringOption(path)); }
AbstractJsonStreamFormat extends ConfigurableBinaryStreamFormat<T> { @Override public ModelOutput<T> createOutput( Class<? extends T> dataType, String path, OutputStream stream) throws IOException, InterruptedException { JsonFormat<T> format = getJsonFormat(); Set<OutputOption> options = OUTPUT_OPTS; OutputStream destination = decorate(stream); return new DecoratedOutput(format.open(path, destination, options), new StringOption(path)); } }
AbstractJsonStreamFormat extends ConfigurableBinaryStreamFormat<T> { @Override public ModelOutput<T> createOutput( Class<? extends T> dataType, String path, OutputStream stream) throws IOException, InterruptedException { JsonFormat<T> format = getJsonFormat(); Set<OutputOption> options = OUTPUT_OPTS; OutputStream destination = decorate(stream); return new DecoratedOutput(format.open(path, destination, options), new StringOption(path)); }  }
AbstractJsonStreamFormat extends ConfigurableBinaryStreamFormat<T> { @Override public ModelOutput<T> createOutput( Class<? extends T> dataType, String path, OutputStream stream) throws IOException, InterruptedException { JsonFormat<T> format = getJsonFormat(); Set<OutputOption> options = OUTPUT_OPTS; OutputStream destination = decorate(stream); return new DecoratedOutput(format.open(path, destination, options), new StringOption(path)); }  final JsonFormat<T> getJsonFormat(); @Override final long getPreferredFragmentSize(); @Override final long getMinimumFragmentSize(); @Override ModelInput<T> createInput(
            Class<? extends T> dataType,
            String path,
            InputStream stream,
            long offset, long fragmentSize); @Override ModelOutput<T> createOutput(
            Class<? extends T> dataType,
            String path,
            OutputStream stream); }
AbstractJsonStreamFormat extends ConfigurableBinaryStreamFormat<T> { @Override public ModelOutput<T> createOutput( Class<? extends T> dataType, String path, OutputStream stream) throws IOException, InterruptedException { JsonFormat<T> format = getJsonFormat(); Set<OutputOption> options = OUTPUT_OPTS; OutputStream destination = decorate(stream); return new DecoratedOutput(format.open(path, destination, options), new StringOption(path)); }  final JsonFormat<T> getJsonFormat(); @Override final long getPreferredFragmentSize(); @Override final long getMinimumFragmentSize(); @Override ModelInput<T> createInput(
            Class<? extends T> dataType,
            String path,
            InputStream stream,
            long offset, long fragmentSize); @Override ModelOutput<T> createOutput(
            Class<? extends T> dataType,
            String path,
            OutputStream stream);  }