public class FsShell extends Object implements Closeable, DisposableBean
This class mimics as much as possible the shell behavior yet it is meant to be used in a programmatic way,
that is rather then printing out information, they return object or collections that one can iterate through. If the message is
all that's needed then simply call the returned object Object.toString() explicitly or implicitly (by printing out or doing string
concatenation).
| Constructor and Description |
|---|
FsShell(Configuration configuration)
Constructs a new
FsShell instance. |
FsShell(Configuration configuration,
FileSystem fs)
Constructs a new
FsShell instance. |
| Modifier and Type | Method and Description |
|---|---|
Collection<Path> |
cat(String... uris) |
Collection<Path> |
cat(String uri) |
void |
chgrp(boolean recursive,
String group,
String... uris) |
void |
chgrp(boolean recursive,
String group,
String uri) |
void |
chgrp(String group,
String... uris) |
void |
chgrp(String group,
String uri) |
void |
chgrpr(String group,
String... uris) |
void |
chgrpr(String group,
String uri) |
void |
chmod(boolean recursive,
Integer mode,
String... uris) |
void |
chmod(boolean recursive,
Integer mode,
String uri) |
void |
chmod(boolean recursive,
String mode,
String... uris) |
void |
chmod(boolean recursive,
String mode,
String uri) |
void |
chmod(Integer mode,
String... uris) |
void |
chmod(Integer mode,
String uri) |
void |
chmod(String mode,
String... uris) |
void |
chmod(String mode,
String uri) |
void |
chmodr(Integer mode,
String... uris) |
void |
chmodr(Integer mode,
String uri) |
void |
chmodr(String mode,
String... uris) |
void |
chmodr(String mode,
String uri) |
void |
chown(boolean recursive,
String owner,
String... uris) |
void |
chown(boolean recursive,
String owner,
String uri) |
void |
chown(String mode,
String... uris) |
void |
chown(String mode,
String uri) |
void |
chownr(String mode,
String... uris) |
void |
chownr(String mode,
String uri) |
void |
close() |
void |
copyFromLocal(String src,
String dst) |
void |
copyFromLocal(String src,
String src2,
String... dst) |
void |
copyToLocal(boolean ignorecrc,
boolean crc,
String src,
String localdst) |
void |
copyToLocal(String src,
String localdst) |
Map<Path,ContentSummary> |
count(boolean quota,
String... uris) |
Map<Path,ContentSummary> |
count(boolean quota,
String uri) |
Map<Path,ContentSummary> |
count(String... uris) |
Map<Path,ContentSummary> |
count(String uri) |
void |
cp(String src,
String dst) |
void |
cp(String src,
String src2,
String... dst) |
void |
destroy() |
Map<Path,Long> |
du(boolean summary,
String... strings) |
Map<Path,Long> |
du(boolean summary,
String string) |
Map<Path,Long> |
du(String... uris) |
Map<Path,Long> |
du(String uri) |
Map<Path,Long> |
dus(String... strings) |
Map<Path,Long> |
dus(String string) |
void |
expunge() |
void |
get(boolean ignorecrc,
boolean crc,
String src,
String dst) |
void |
get(String src,
String dst) |
void |
getmerge(String src,
String localdst) |
void |
getmerge(String src,
String localdst,
boolean addnl) |
Collection<FileStatus> |
ls(boolean recursive,
String... match) |
Collection<FileStatus> |
ls(boolean recursive,
String match) |
Collection<FileStatus> |
ls(String... match) |
Collection<FileStatus> |
ls(String match) |
Collection<FileStatus> |
lsr(String... match) |
Collection<FileStatus> |
lsr(String match) |
void |
mkdir(String... uris) |
void |
mkdir(String uri) |
void |
moveFromLocal(String localsrc,
String dst) |
void |
moveFromLocal(String localsrc,
String localsrc2,
String... dst) |
void |
moveToLocal(boolean crc,
String src,
String dst) |
void |
moveToLocal(String src,
String dst) |
void |
mv(String src,
String dst) |
void |
mv(String src,
String src2,
String... dst) |
void |
put(String localsrc,
String dst) |
void |
put(String localsrc,
String localsrc2,
String... dst) |
void |
rm(boolean recursive,
boolean skipTrash,
String... uris) |
void |
rm(boolean recursive,
String... uris) |
void |
rm(boolean recursive,
String uri) |
void |
rm(String... uris) |
void |
rm(String uri) |
void |
rmr(boolean skipTrash,
String... uris) |
void |
rmr(boolean skipTrash,
String uri) |
void |
rmr(String... uris) |
void |
rmr(String uri) |
void |
setrep(boolean recursive,
short replication,
String... uris) |
void |
setrep(boolean recursive,
short replication,
String uri) |
void |
setrep(long secondsToWait,
boolean recursive,
short replication,
String... uris) |
void |
setrep(long secondsToWait,
boolean recursive,
short replication,
String uri) |
void |
setrep(short replication,
String... uris) |
void |
setrep(short replication,
String uri) |
void |
setrepr(long secondsToWait,
short replication,
String... uris) |
void |
setrepr(long secondsToWait,
short replication,
String uri) |
void |
setrepr(short replication,
String... uris) |
void |
setrepr(short replication,
String uri) |
boolean |
test(boolean exists,
boolean zero,
boolean directory,
String uri) |
boolean |
test(String uri) |
Collection<String> |
text(String... uris) |
Collection<String> |
text(String uri) |
void |
touchz(String... uris) |
void |
touchz(String uri) |
public FsShell(Configuration configuration)
FsShell instance.configuration - Hadoop configuration to use.public FsShell(Configuration configuration, FileSystem fs)
FsShell instance.configuration - Hadoop configuration to use.fs - Hadoop file system to use.public void destroy()
throws Exception
destroy in interface DisposableBeanExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic Collection<Path> cat(String uri)
public Collection<Path> cat(String... uris)
public Map<Path,ContentSummary> count(String uri)
public Map<Path,ContentSummary> count(String... uris)
public Map<Path,ContentSummary> count(boolean quota, String uri)
public Map<Path,ContentSummary> count(boolean quota, String... uris)
public void expunge()
public Collection<FileStatus> ls(String match)
public Collection<FileStatus> ls(String... match)
public Collection<FileStatus> ls(boolean recursive, String match)
public Collection<FileStatus> ls(boolean recursive, String... match)
public Collection<FileStatus> lsr(String match)
public Collection<FileStatus> lsr(String... match)
public void mkdir(String uri)
public void mkdir(String... uris)
public void rm(String uri)
public void rm(String... uris)
public void rm(boolean recursive,
String uri)
public void rm(boolean recursive,
String... uris)
public void rm(boolean recursive,
boolean skipTrash,
String... uris)
public void rmr(String uri)
public void rmr(String... uris)
public void rmr(boolean skipTrash,
String uri)
public void rmr(boolean skipTrash,
String... uris)
public void setrep(short replication,
String uri)
public void setrep(short replication,
String... uris)
public void setrep(boolean recursive,
short replication,
String uri)
public void setrep(boolean recursive,
short replication,
String... uris)
public void setrepr(short replication,
String... uris)
public void setrepr(short replication,
String uri)
public void setrepr(long secondsToWait,
short replication,
String uri)
public void setrepr(long secondsToWait,
short replication,
String... uris)
public void setrep(long secondsToWait,
boolean recursive,
short replication,
String uri)
public void setrep(long secondsToWait,
boolean recursive,
short replication,
String... uris)
public boolean test(String uri)
public boolean test(boolean exists,
boolean zero,
boolean directory,
String uri)
public Collection<String> text(String uri)
public Collection<String> text(String... uris)
public void touchz(String uri)
public void touchz(String... uris)