@Test public void output_header() throws Exception { MockFormat format = format(HeaderType.FORCE, "a", "b", "c"); ByteArrayOutputStream output = new ByteArrayOutputStream(); try (ModelOutput<String[]> out = format.createOutput(String[].class, "dummy", output)) { dump(out, new String[][] { { "A", "B", "C", }, { "D", "E", "F", }, }); } assertThat(deserialize(output.toByteArray()), is(new String[][] { { "a", "b", "c", }, { "A", "B", "C", }, { "D", "E", "F", }, })); }
@Override public ModelOutput<T> createOutput( Class<? extends T> dataType, String path, OutputStream stream) throws IOException, InterruptedException { TextFormat format = getTextFormat(); RecordDefinition<T> record = getRecordDefinition(); Set<OutputOption> options = OUTPUT_OPTS; OutputStream destination = decorate(stream); return new DecoratedOutput(record.newOutput(format.open(destination), path, options), new StringOption(path)); }
AbstractTextStreamFormat extends ConfigurableBinaryStreamFormat<T> { @Override public ModelOutput<T> createOutput( Class<? extends T> dataType, String path, OutputStream stream) throws IOException, InterruptedException { TextFormat format = getTextFormat(); RecordDefinition<T> record = getRecordDefinition(); Set<OutputOption> options = OUTPUT_OPTS; OutputStream destination = decorate(stream); return new DecoratedOutput(record.newOutput(format.open(destination), path, options), new StringOption(path)); } }
AbstractTextStreamFormat extends ConfigurableBinaryStreamFormat<T> { @Override public ModelOutput<T> createOutput( Class<? extends T> dataType, String path, OutputStream stream) throws IOException, InterruptedException { TextFormat format = getTextFormat(); RecordDefinition<T> record = getRecordDefinition(); Set<OutputOption> options = OUTPUT_OPTS; OutputStream destination = decorate(stream); return new DecoratedOutput(record.newOutput(format.open(destination), path, options), new StringOption(path)); }  }
AbstractTextStreamFormat extends ConfigurableBinaryStreamFormat<T> { @Override public ModelOutput<T> createOutput( Class<? extends T> dataType, String path, OutputStream stream) throws IOException, InterruptedException { TextFormat format = getTextFormat(); RecordDefinition<T> record = getRecordDefinition(); Set<OutputOption> options = OUTPUT_OPTS; OutputStream destination = decorate(stream); return new DecoratedOutput(record.newOutput(format.open(destination), path, options), new StringOption(path)); }  final TextFormat getTextFormat(); final RecordDefinition<T> getRecordDefinition(); @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); }
AbstractTextStreamFormat extends ConfigurableBinaryStreamFormat<T> { @Override public ModelOutput<T> createOutput( Class<? extends T> dataType, String path, OutputStream stream) throws IOException, InterruptedException { TextFormat format = getTextFormat(); RecordDefinition<T> record = getRecordDefinition(); Set<OutputOption> options = OUTPUT_OPTS; OutputStream destination = decorate(stream); return new DecoratedOutput(record.newOutput(format.open(destination), path, options), new StringOption(path)); }  final TextFormat getTextFormat(); final RecordDefinition<T> getRecordDefinition(); @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);  }