DistCpUtils { public static String packAttributes(EnumSet<FileAttribute> attributes) { StringBuffer buffer = new StringBuffer(5); int len = 0; for (FileAttribute attribute : attributes) { buffer.append(attribute.name().charAt(0)); len++; } return buffer.substring(0, len); }  static long getFileSize(Path path, Configuration configuration); static void publish(Configuration configuration,
                                 String label, T value); static int getInt(Configuration configuration, String label); static long getLong(Configuration configuration, String label); static Class<? extends InputFormat> getStrategy(Configuration conf,
                                                                 DistCpOptions options); static String getRelativePath(Path sourceRootPath, Path childPath); static String packAttributes(EnumSet<FileAttribute> attributes); static EnumSet<FileAttribute> unpackAttributes(String attributes); static void preserve(FileSystem targetFS, Path path,
                              FileStatus srcFileStatus,
                              EnumSet<FileAttribute> attributes); static Path sortListing(FileSystem fs, Configuration conf, Path sourceListing); static DecimalFormat getFormatter(); static String getStringDescriptionFor(long nBytes); static boolean checksumsAreEqual(FileSystem sourceFS, Path source,
                                   FileSystem targetFS, Path target); static boolean compareFs(FileSystem srcFs, FileSystem destFs);  }
@Test public void testPackAttributes() { EnumSet<FileAttribute> attributes = EnumSet.noneOf(FileAttribute.class); Assert.assertEquals(DistCpUtils.packAttributes(attributes), ""); attributes.add(FileAttribute.REPLICATION); Assert.assertEquals(DistCpUtils.packAttributes(attributes), "R"); Assert.assertEquals(attributes, DistCpUtils.unpackAttributes("R")); attributes.add(FileAttribute.BLOCKSIZE); Assert.assertEquals(DistCpUtils.packAttributes(attributes), "RB"); Assert.assertEquals(attributes, DistCpUtils.unpackAttributes("RB")); attributes.add(FileAttribute.USER); Assert.assertEquals(DistCpUtils.packAttributes(attributes), "RBU"); Assert.assertEquals(attributes, DistCpUtils.unpackAttributes("RBU")); attributes.add(FileAttribute.GROUP); Assert.assertEquals(DistCpUtils.packAttributes(attributes), "RBUG"); Assert.assertEquals(attributes, DistCpUtils.unpackAttributes("RBUG")); attributes.add(FileAttribute.PERMISSION); Assert.assertEquals(DistCpUtils.packAttributes(attributes), "RBUGP"); Assert.assertEquals(attributes, DistCpUtils.unpackAttributes("RBUGP")); }