List of usage examples for java.util.zip CheckedOutputStream write
public void write(int b) throws IOException
From source file:org.apache.hadoop.mapred.TestShuffleHandler.java
private static void createIndexFile(File indexFile, Configuration conf) throws IOException { if (indexFile.exists()) { System.out.println("Deleting existing file"); indexFile.delete();//from ww w. j av a2 s .c om } indexFile.createNewFile(); FSDataOutputStream output = FileSystem.getLocal(conf).getRaw() .append(new Path(indexFile.getAbsolutePath())); Checksum crc = new PureJavaCrc32(); crc.reset(); CheckedOutputStream chk = new CheckedOutputStream(output, crc); String msg = "Writing new index file. This file will be used only " + "for the testing."; chk.write(Arrays.copyOf(msg.getBytes(), MapTask.MAP_OUTPUT_INDEX_RECORD_LENGTH)); output.writeLong(chk.getChecksum().getValue()); output.close(); }