/** * Get the filesystem associated with a uri. * * @param uri * @return the filesystem * @throws IOException */ public FileSystem getFileSystem(URI uri) throws IOException { return getFileSystem(uri, config); }
/** * Get the filesystem associated with a uri. * * @param uri * @return the filesystem * @throws IOException */ public FileSystem getFileSystem(URI uri) throws IOException { return getFileSystem(uri, config); }
private void validate(boolean initial) { if (replace && initial) { try { final URI outuri = SequenceFileUtility.convertToURI(output); final FileSystem fs = SequenceFileUtility.getFileSystem(outuri, new Configuration()); fs.delete(new Path(outuri.toString()), true); } catch (final IOException e) { } } }
public static ZipOutputStream openZipOutputStream(String uriOrPath) throws IOException { final URI uri = convertToURI(uriOrPath); final FileSystem fs = getFileSystem(uri, new Configuration()); final Path path = new Path(uri.toString()); final ZipOutputStream zos = new ZipOutputStream(fs.create(path)); zos.setLevel(Deflater.BEST_COMPRESSION); return zos; }
public static ZipOutputStream openZipOutputStream(String uriOrPath) throws IOException { final URI uri = convertToURI(uriOrPath); final FileSystem fs = getFileSystem(uri, new Configuration()); final Path path = new Path(uri.toString()); final ZipOutputStream zos = new ZipOutputStream(fs.create(path)); zos.setLevel(Deflater.BEST_COMPRESSION); return zos; }
/** * Find a record and write the value to a file. * * @param key * @param uriOrPath * @param offset * @return false if record not found, true otherwise. * @throws IOException */ public boolean findAndExport(K key, String uriOrPath, long offset) throws IOException { FileSystem fs = null; Path p = null; if (uriOrPath != null) { final URI uri = convertToURI(uriOrPath); fs = getFileSystem(uri); p = new Path(uri.toString()); } return findAndExport(key, fs, p, offset); }
/** * Find a record and write the value to a file. * * @param key * @param uriOrPath * @param offset * @return false if record not found, true otherwise. * @throws IOException */ public boolean findAndExport(K key, String uriOrPath, long offset) throws IOException { FileSystem fs = null; Path p = null; if (uriOrPath != null) { final URI uri = convertToURI(uriOrPath); fs = getFileSystem(uri); p = new Path(uri.toString()); } return findAndExport(key, fs, p, offset); }
/** * Extracts file to a directory. Read mode only. * * @param uriOrPath * path or uri to extract to. * @param naming * the naming strategy * @param extrState * the extraction state * @param addExtension * if true, then file extensions are added to each record * automatically * @param offset * offset from which to start. Can be used to reduce number of * files extracted. * @throws IOException */ public void exportData(String uriOrPath, NamingStrategy naming, ExtractionState extrState, boolean addExtension, long offset) throws IOException { FileSystem fs = null; Path p = null; if (uriOrPath != null) { final URI uri = convertToURI(uriOrPath); fs = getFileSystem(uri); p = new Path(uri.toString()); } exportData(fs, p, naming, extrState, addExtension, offset); }
/** * Extracts file to a directory. Read mode only. * * @param uriOrPath * path or uri to extract to. * @param naming * the naming strategy * @param extrState * the extraction state * @param addExtension * if true, then file extensions are added to each record * automatically * @param offset * offset from which to start. Can be used to reduce number of * files extracted. * @throws IOException */ public void exportData(String uriOrPath, NamingStrategy naming, ExtractionState extrState, boolean addExtension, long offset) throws IOException { FileSystem fs = null; Path p = null; if (uriOrPath != null) { final URI uri = convertToURI(uriOrPath); fs = getFileSystem(uri); p = new Path(uri.toString()); } exportData(fs, p, naming, extrState, addExtension, offset); }
private void setup(URI uri, boolean read, Map<String, String> metadata) throws IOException { fileSystem = getFileSystem(uri); sequenceFilePath = new Path(uri.toString());
private void setup(URI uri, boolean read, Map<String, String> metadata) throws IOException { fileSystem = getFileSystem(uri); sequenceFilePath = new Path(uri.toString());
final FileSystem fs = utility.getFileSystem(uri); final Path path = utility.getPath(uri);