@Override public ModelInput<StringBuilder> createInput( Class<? extends StringBuilder> dataType, FileSystem fileSystem, Path path, long offset, long fragmentSize, Counter counter) throws IOException, InterruptedException { FileSystem fs = FileSystem.get(path.toUri(), getConf()); FSDataInputStream in = fs.open(path); boolean succeed = false; try { in.seek(offset); ModelInput<StringBuilder> result = format.createInput( dataType, path.toString(), new CountInputStream(in, counter), offset, fragmentSize); succeed = true; return result; } finally { if (succeed == false) { in.close(); } } }
@Override public ModelOutput<StringBuilder> createOutput( Class<? extends StringBuilder> dataType, FileSystem fileSystem, Path path, Counter counter) throws IOException, InterruptedException { FileSystem fs = FileSystem.get(path.toUri(), getConf()); FSDataOutputStream out = fs.create(path); return format.createOutput(dataType, path.toString(), new CountOutputStream(out, counter)); }
@Override public long getMinimumFragmentSize() throws IOException, InterruptedException { return format.getMinimumFragmentSize(); }
@Override public Class<StringBuilder> getSupportedType() { return format.getSupportedType(); }