@Test @Category(UnitTest.class) public void testWriteSplitsNoSplitsGenerated() throws Exception { try { subject = new FileSplit(); subject.writeSplits(new ByteArrayOutputStream()); fail("Did not throw expection when trying to write splits with generating them first"); } catch (Splits.SplitException e) { e.printStackTrace(); } }
public void writeSplits(OutputStream stream) throws SplitException { if (splits == null) { throw new SplitException("Splits not generated, call readSplits() or generateSplits() first"); } PrintWriter writer = new PrintWriter(stream); writer.println(VERSION); writer.println(splits.length); for (SplitInfo split : splits) { writer.print(((FileSplitInfo) split).getStartId()); writer.print(SPACER); writer.print(((FileSplitInfo) split).getEndId()); writer.print(SPACER); writer.print(((FileSplitInfo) split).getName()); writer.print(SPACER); writer.println(split.getPartition()); } writer.close(); }
FileSplit extends Splits { public void writeSplits(OutputStream stream) throws SplitException { if (splits == null) { throw new SplitException("Splits not generated, call readSplits() or generateSplits() first"); } PrintWriter writer = new PrintWriter(stream); writer.println(VERSION); writer.println(splits.length); for (SplitInfo split : splits) { writer.print(((FileSplitInfo) split).getStartId()); writer.print(SPACER); writer.print(((FileSplitInfo) split).getEndId()); writer.print(SPACER); writer.print(((FileSplitInfo) split).getName()); writer.print(SPACER); writer.println(split.getPartition()); } writer.close(); } }
FileSplit extends Splits { public void writeSplits(OutputStream stream) throws SplitException { if (splits == null) { throw new SplitException("Splits not generated, call readSplits() or generateSplits() first"); } PrintWriter writer = new PrintWriter(stream); writer.println(VERSION); writer.println(splits.length); for (SplitInfo split : splits) { writer.print(((FileSplitInfo) split).getStartId()); writer.print(SPACER); writer.print(((FileSplitInfo) split).getEndId()); writer.print(SPACER); writer.print(((FileSplitInfo) split).getName()); writer.print(SPACER); writer.println(split.getPartition()); } writer.close(); }  }
FileSplit extends Splits { public void writeSplits(OutputStream stream) throws SplitException { if (splits == null) { throw new SplitException("Splits not generated, call readSplits() or generateSplits() first"); } PrintWriter writer = new PrintWriter(stream); writer.println(VERSION); writer.println(splits.length); for (SplitInfo split : splits) { writer.print(((FileSplitInfo) split).getStartId()); writer.print(SPACER); writer.print(((FileSplitInfo) split).getEndId()); writer.print(SPACER); writer.print(((FileSplitInfo) split).getName()); writer.print(SPACER); writer.println(split.getPartition()); } writer.close(); }  void generateSplits(FileSplitInfo[] splits); void generateSplits(long[] startIds, long[] endIds, String[] names); void generateSplits(Path parent, Configuration conf); @Override String findSplitFile(Path parent); @Override void generateSplits(SplitGenerator generator); void readSplits(InputStream stream); @SuppressWarnings("squid:S1166") // Exception caught and handled boolean isVersion2(Path splitsfile); void readSplits(Path parent); void writeSplits(OutputStream stream); void writeSplits(Path parent); @Override void readExternal(ObjectInput in); }
FileSplit extends Splits { public void writeSplits(OutputStream stream) throws SplitException { if (splits == null) { throw new SplitException("Splits not generated, call readSplits() or generateSplits() first"); } PrintWriter writer = new PrintWriter(stream); writer.println(VERSION); writer.println(splits.length); for (SplitInfo split : splits) { writer.print(((FileSplitInfo) split).getStartId()); writer.print(SPACER); writer.print(((FileSplitInfo) split).getEndId()); writer.print(SPACER); writer.print(((FileSplitInfo) split).getName()); writer.print(SPACER); writer.println(split.getPartition()); } writer.close(); }  void generateSplits(FileSplitInfo[] splits); void generateSplits(long[] startIds, long[] endIds, String[] names); void generateSplits(Path parent, Configuration conf); @Override String findSplitFile(Path parent); @Override void generateSplits(SplitGenerator generator); void readSplits(InputStream stream); @SuppressWarnings("squid:S1166") // Exception caught and handled boolean isVersion2(Path splitsfile); void readSplits(Path parent); void writeSplits(OutputStream stream); void writeSplits(Path parent); @Override void readExternal(ObjectInput in); static final String SPLIT_FILE; static final String OLD_SPLIT_FILE; }