public void load(File file, boolean requireSameLayoutVersion) throws IOException { Preconditions.checkState(impl == null, "Image already loaded!"); FileInputStream is = null; try { is = new FileInputStream(file); byte[] magic = new byte[FSImageUtil.MAGIC_HEADER.length]; IOUtils.readFully(is, magic, 0, magic.length); if (Arrays.equals(magic, FSImageUtil.MAGIC_HEADER)) { FSImageFormatProtobuf.Loader loader = new FSImageFormatProtobuf.Loader( conf, fsn, requireSameLayoutVersion); impl = loader; loader.load(file); } else { Loader loader = new Loader(conf, fsn); impl = loader; loader.load(file); } } finally { IOUtils.cleanupWithLogger(LOG, is); } } }
public void load(File file, boolean requireSameLayoutVersion) throws IOException { Preconditions.checkState(impl == null, "Image already loaded!"); FileInputStream is = null; try { is = new FileInputStream(file); byte[] magic = new byte[FSImageUtil.MAGIC_HEADER.length]; IOUtils.readFully(is, magic, 0, magic.length); if (Arrays.equals(magic, FSImageUtil.MAGIC_HEADER)) { FSImageFormatProtobuf.Loader loader = new FSImageFormatProtobuf.Loader( conf, fsn, requireSameLayoutVersion); impl = loader; loader.load(file); } else { Loader loader = new Loader(conf, fsn); impl = loader; loader.load(file); } } finally { IOUtils.cleanup(LOG, is); } } }
public void load(File file, boolean requireSameLayoutVersion) throws IOException { Preconditions.checkState(impl == null, "Image already loaded!"); FileInputStream is = null; try { is = new FileInputStream(file); byte[] magic = new byte[FSImageUtil.MAGIC_HEADER.length]; IOUtils.readFully(is, magic, 0, magic.length); if (Arrays.equals(magic, FSImageUtil.MAGIC_HEADER)) { FSImageFormatProtobuf.Loader loader = new FSImageFormatProtobuf.Loader( conf, fsn, requireSameLayoutVersion); impl = loader; loader.load(file); } else { Loader loader = new Loader(conf, fsn); impl = loader; loader.load(file); } } finally { IOUtils.cleanup(LOG, is); } } }