VectorCache { public static Vector load(Configuration conf) throws IOException { URI[] files = DistributedCache.getCacheFiles(conf); if (files == null || files.length < 1) { return null; } return load(conf, new Path(files[0].getPath())); } private  VectorCache(); static void save(Writable key,
                          Vector vector,
                          Path output,
                          Configuration conf,
                          boolean overwritePath,
                          boolean deleteOnExit); static void save(Writable key, Vector vector, Path output, Configuration conf); static Vector load(Configuration conf); static Vector load(Configuration conf, Path input);  }
@Test public void testLoad() throws Exception { Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(conf); Writable key = new IntWritable(0); Vector value = new DenseVector(VECTOR); Path path = getTestTempDirPath("output"); path = fs.makeQualified(path); fs.deleteOnExit(path); HadoopUtil.delete(conf, path); DistributedCache.setCacheFiles(new URI[] {path.toUri()}, conf); SequenceFile.Writer writer = new SequenceFile.Writer(fs, conf, path, IntWritable.class, VectorWritable.class); writer.append(key, new VectorWritable(value)); writer.close(); Vector result = VectorCache.load(conf); assertNotNull("Vector is not null", result); assertEquals("Loaded vector is identical to original", result, value); }