public class FsShell
extends java.lang.Object
implements java.io.Closeable, org.springframework.beans.factory.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(org.apache.hadoop.conf.Configuration configuration)
Constructs a new
FsShell instance. |
FsShell(org.apache.hadoop.conf.Configuration configuration,
org.apache.hadoop.fs.FileSystem fs)
Constructs a new
FsShell instance. |
Modifier and Type | Method and Description |
---|---|
java.util.Collection<org.apache.hadoop.fs.Path> |
cat(java.lang.String... uris) |
java.util.Collection<org.apache.hadoop.fs.Path> |
cat(java.lang.String uri) |
void |
chgrp(boolean recursive,
java.lang.String group,
java.lang.String... uris) |
void |
chgrp(boolean recursive,
java.lang.String group,
java.lang.String uri) |
void |
chgrp(java.lang.String group,
java.lang.String... uris) |
void |
chgrp(java.lang.String group,
java.lang.String uri) |
void |
chgrpr(java.lang.String group,
java.lang.String... uris) |
void |
chgrpr(java.lang.String group,
java.lang.String uri) |
void |
chmod(boolean recursive,
java.lang.Integer mode,
java.lang.String... uris) |
void |
chmod(boolean recursive,
java.lang.Integer mode,
java.lang.String uri) |
void |
chmod(boolean recursive,
java.lang.String mode,
java.lang.String... uris) |
void |
chmod(boolean recursive,
java.lang.String mode,
java.lang.String uri) |
void |
chmod(java.lang.Integer mode,
java.lang.String... uris) |
void |
chmod(java.lang.Integer mode,
java.lang.String uri) |
void |
chmod(java.lang.String mode,
java.lang.String... uris) |
void |
chmod(java.lang.String mode,
java.lang.String uri) |
void |
chmodr(java.lang.Integer mode,
java.lang.String... uris) |
void |
chmodr(java.lang.Integer mode,
java.lang.String uri) |
void |
chmodr(java.lang.String mode,
java.lang.String... uris) |
void |
chmodr(java.lang.String mode,
java.lang.String uri) |
void |
chown(boolean recursive,
java.lang.String owner,
java.lang.String... uris) |
void |
chown(boolean recursive,
java.lang.String owner,
java.lang.String uri) |
void |
chown(java.lang.String mode,
java.lang.String... uris) |
void |
chown(java.lang.String mode,
java.lang.String uri) |
void |
chownr(java.lang.String mode,
java.lang.String... uris) |
void |
chownr(java.lang.String mode,
java.lang.String uri) |
void |
close() |
void |
copyFromLocal(java.lang.String src,
java.lang.String dst) |
void |
copyFromLocal(java.lang.String src,
java.lang.String src2,
java.lang.String... dst) |
void |
copyToLocal(boolean ignorecrc,
boolean crc,
java.lang.String src,
java.lang.String localdst) |
void |
copyToLocal(java.lang.String src,
java.lang.String localdst) |
java.util.Map<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.ContentSummary> |
count(boolean quota,
java.lang.String... uris) |
java.util.Map<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.ContentSummary> |
count(boolean quota,
java.lang.String uri) |
java.util.Map<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.ContentSummary> |
count(java.lang.String... uris) |
java.util.Map<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.ContentSummary> |
count(java.lang.String uri) |
void |
cp(java.lang.String src,
java.lang.String dst) |
void |
cp(java.lang.String src,
java.lang.String src2,
java.lang.String... dst) |
void |
destroy() |
java.util.Map<org.apache.hadoop.fs.Path,java.lang.Long> |
du(boolean summary,
java.lang.String... strings) |
java.util.Map<org.apache.hadoop.fs.Path,java.lang.Long> |
du(boolean summary,
java.lang.String string) |
java.util.Map<org.apache.hadoop.fs.Path,java.lang.Long> |
du(java.lang.String... uris) |
java.util.Map<org.apache.hadoop.fs.Path,java.lang.Long> |
du(java.lang.String uri) |
java.util.Map<org.apache.hadoop.fs.Path,java.lang.Long> |
dus(java.lang.String... strings) |
java.util.Map<org.apache.hadoop.fs.Path,java.lang.Long> |
dus(java.lang.String string) |
void |
expunge() |
void |
get(boolean ignorecrc,
boolean crc,
java.lang.String src,
java.lang.String dst) |
void |
get(java.lang.String src,
java.lang.String dst) |
void |
getmerge(java.lang.String src,
java.lang.String localdst) |
void |
getmerge(java.lang.String src,
java.lang.String localdst,
boolean addnl) |
java.util.Collection<org.apache.hadoop.fs.FileStatus> |
ls(boolean recursive,
java.lang.String... match) |
java.util.Collection<org.apache.hadoop.fs.FileStatus> |
ls(boolean recursive,
java.lang.String match) |
java.util.Collection<org.apache.hadoop.fs.FileStatus> |
ls(java.lang.String... match) |
java.util.Collection<org.apache.hadoop.fs.FileStatus> |
ls(java.lang.String match) |
java.util.Collection<org.apache.hadoop.fs.FileStatus> |
lsr(java.lang.String... match) |
java.util.Collection<org.apache.hadoop.fs.FileStatus> |
lsr(java.lang.String match) |
void |
mkdir(java.lang.String... uris) |
void |
mkdir(java.lang.String uri) |
void |
moveFromLocal(java.lang.String localsrc,
java.lang.String dst) |
void |
moveFromLocal(java.lang.String localsrc,
java.lang.String localsrc2,
java.lang.String... dst) |
void |
moveToLocal(boolean crc,
java.lang.String src,
java.lang.String dst) |
void |
moveToLocal(java.lang.String src,
java.lang.String dst) |
void |
mv(java.lang.String src,
java.lang.String dst) |
void |
mv(java.lang.String src,
java.lang.String src2,
java.lang.String... dst) |
void |
put(java.lang.String localsrc,
java.lang.String dst) |
void |
put(java.lang.String localsrc,
java.lang.String localsrc2,
java.lang.String... dst) |
void |
rm(boolean recursive,
boolean skipTrash,
java.lang.String... uris) |
void |
rm(boolean recursive,
java.lang.String... uris) |
void |
rm(boolean recursive,
java.lang.String uri) |
void |
rm(java.lang.String... uris) |
void |
rm(java.lang.String uri) |
void |
rmr(boolean skipTrash,
java.lang.String... uris) |
void |
rmr(boolean skipTrash,
java.lang.String uri) |
void |
rmr(java.lang.String... uris) |
void |
rmr(java.lang.String uri) |
void |
setrep(boolean recursive,
short replication,
java.lang.String... uris) |
void |
setrep(boolean recursive,
short replication,
java.lang.String uri) |
void |
setrep(long secondsToWait,
boolean recursive,
short replication,
java.lang.String... uris) |
void |
setrep(long secondsToWait,
boolean recursive,
short replication,
java.lang.String uri) |
void |
setrep(short replication,
java.lang.String... uris) |
void |
setrep(short replication,
java.lang.String uri) |
void |
setrepr(long secondsToWait,
short replication,
java.lang.String... uris) |
void |
setrepr(long secondsToWait,
short replication,
java.lang.String uri) |
void |
setrepr(short replication,
java.lang.String... uris) |
void |
setrepr(short replication,
java.lang.String uri) |
boolean |
test(boolean exists,
boolean zero,
boolean directory,
java.lang.String uri) |
boolean |
test(java.lang.String uri) |
java.util.Collection<java.lang.String> |
text(java.lang.String... uris) |
java.util.Collection<java.lang.String> |
text(java.lang.String uri) |
void |
touchz(java.lang.String... uris) |
void |
touchz(java.lang.String uri) |
public FsShell(org.apache.hadoop.conf.Configuration configuration)
FsShell
instance.configuration
- Hadoop configuration to use.public FsShell(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.FileSystem fs)
FsShell
instance.configuration
- Hadoop configuration to use.fs
- Hadoop file system to use.public void destroy() throws java.lang.Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
java.lang.Exception
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public java.util.Collection<org.apache.hadoop.fs.Path> cat(java.lang.String uri)
public java.util.Collection<org.apache.hadoop.fs.Path> cat(java.lang.String... uris)
public void chgrp(java.lang.String group, java.lang.String uri)
public void chgrp(java.lang.String group, java.lang.String... uris)
public void chgrpr(java.lang.String group, java.lang.String uri)
public void chgrpr(java.lang.String group, java.lang.String... uris)
public void chgrp(boolean recursive, java.lang.String group, java.lang.String uri)
public void chgrp(boolean recursive, java.lang.String group, java.lang.String... uris)
public void chmod(java.lang.String mode, java.lang.String uri)
public void chmod(java.lang.String mode, java.lang.String... uris)
public void chmodr(java.lang.String mode, java.lang.String uri)
public void chmodr(java.lang.String mode, java.lang.String... uris)
public void chmodr(java.lang.Integer mode, java.lang.String uri)
public void chmodr(java.lang.Integer mode, java.lang.String... uris)
public void chmod(java.lang.Integer mode, java.lang.String uri)
public void chmod(java.lang.Integer mode, java.lang.String... uris)
public void chmod(boolean recursive, java.lang.Integer mode, java.lang.String uri)
public void chmod(boolean recursive, java.lang.Integer mode, java.lang.String... uris)
public void chmod(boolean recursive, java.lang.String mode, java.lang.String uri)
public void chmod(boolean recursive, java.lang.String mode, java.lang.String... uris)
public void chown(java.lang.String mode, java.lang.String uri)
public void chown(java.lang.String mode, java.lang.String... uris)
public void chownr(java.lang.String mode, java.lang.String uri)
public void chownr(java.lang.String mode, java.lang.String... uris)
public void chown(boolean recursive, java.lang.String owner, java.lang.String uri)
public void chown(boolean recursive, java.lang.String owner, java.lang.String... uris)
public void copyFromLocal(java.lang.String src, java.lang.String dst)
public void copyFromLocal(java.lang.String src, java.lang.String src2, java.lang.String... dst)
public void copyToLocal(java.lang.String src, java.lang.String localdst)
public void copyToLocal(boolean ignorecrc, boolean crc, java.lang.String src, java.lang.String localdst)
public java.util.Map<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.ContentSummary> count(java.lang.String uri)
public java.util.Map<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.ContentSummary> count(java.lang.String... uris)
public java.util.Map<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.ContentSummary> count(boolean quota, java.lang.String uri)
public java.util.Map<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.ContentSummary> count(boolean quota, java.lang.String... uris)
public void cp(java.lang.String src, java.lang.String dst)
public void cp(java.lang.String src, java.lang.String src2, java.lang.String... dst)
public java.util.Map<org.apache.hadoop.fs.Path,java.lang.Long> du(java.lang.String uri)
public java.util.Map<org.apache.hadoop.fs.Path,java.lang.Long> du(java.lang.String... uris)
public java.util.Map<org.apache.hadoop.fs.Path,java.lang.Long> du(boolean summary, java.lang.String string)
public java.util.Map<org.apache.hadoop.fs.Path,java.lang.Long> du(boolean summary, java.lang.String... strings)
public java.util.Map<org.apache.hadoop.fs.Path,java.lang.Long> dus(java.lang.String string)
public java.util.Map<org.apache.hadoop.fs.Path,java.lang.Long> dus(java.lang.String... strings)
public void expunge()
public void get(java.lang.String src, java.lang.String dst)
public void get(boolean ignorecrc, boolean crc, java.lang.String src, java.lang.String dst)
public void getmerge(java.lang.String src, java.lang.String localdst)
public void getmerge(java.lang.String src, java.lang.String localdst, boolean addnl)
public java.util.Collection<org.apache.hadoop.fs.FileStatus> ls(java.lang.String match)
public java.util.Collection<org.apache.hadoop.fs.FileStatus> ls(java.lang.String... match)
public java.util.Collection<org.apache.hadoop.fs.FileStatus> ls(boolean recursive, java.lang.String match)
public java.util.Collection<org.apache.hadoop.fs.FileStatus> ls(boolean recursive, java.lang.String... match)
public java.util.Collection<org.apache.hadoop.fs.FileStatus> lsr(java.lang.String match)
public java.util.Collection<org.apache.hadoop.fs.FileStatus> lsr(java.lang.String... match)
public void mkdir(java.lang.String uri)
public void mkdir(java.lang.String... uris)
public void moveFromLocal(java.lang.String localsrc, java.lang.String dst)
public void moveFromLocal(java.lang.String localsrc, java.lang.String localsrc2, java.lang.String... dst)
public void moveToLocal(java.lang.String src, java.lang.String dst)
public void moveToLocal(boolean crc, java.lang.String src, java.lang.String dst)
public void mv(java.lang.String src, java.lang.String dst)
public void mv(java.lang.String src, java.lang.String src2, java.lang.String... dst)
public void put(java.lang.String localsrc, java.lang.String dst)
public void put(java.lang.String localsrc, java.lang.String localsrc2, java.lang.String... dst)
public void rm(java.lang.String uri)
public void rm(java.lang.String... uris)
public void rm(boolean recursive, java.lang.String uri)
public void rm(boolean recursive, java.lang.String... uris)
public void rm(boolean recursive, boolean skipTrash, java.lang.String... uris)
public void rmr(java.lang.String uri)
public void rmr(java.lang.String... uris)
public void rmr(boolean skipTrash, java.lang.String uri)
public void rmr(boolean skipTrash, java.lang.String... uris)
public void setrep(short replication, java.lang.String uri)
public void setrep(short replication, java.lang.String... uris)
public void setrep(boolean recursive, short replication, java.lang.String uri)
public void setrep(boolean recursive, short replication, java.lang.String... uris)
public void setrepr(short replication, java.lang.String... uris)
public void setrepr(short replication, java.lang.String uri)
public void setrepr(long secondsToWait, short replication, java.lang.String uri)
public void setrepr(long secondsToWait, short replication, java.lang.String... uris)
public void setrep(long secondsToWait, boolean recursive, short replication, java.lang.String uri)
public void setrep(long secondsToWait, boolean recursive, short replication, java.lang.String... uris)
public boolean test(java.lang.String uri)
public boolean test(boolean exists, boolean zero, boolean directory, java.lang.String uri)
public java.util.Collection<java.lang.String> text(java.lang.String uri)
public java.util.Collection<java.lang.String> text(java.lang.String... uris)
public void touchz(java.lang.String uri)
public void touchz(java.lang.String... uris)