public class ScpHelper extends AbstractLoggingBean
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_COPY_BUFFER_SIZE
Default size (in bytes) of send / receive buffer size
|
static int |
DEFAULT_RECEIVE_BUFFER_SIZE |
static int |
DEFAULT_SEND_BUFFER_SIZE |
static int |
ERROR |
protected FileSystem |
fileSystem |
protected InputStream |
in |
protected ScpTransferEventListener |
listener |
static int |
MIN_COPY_BUFFER_SIZE
The minimum size for sending / receiving files
|
static int |
MIN_RECEIVE_BUFFER_SIZE |
static int |
MIN_SEND_BUFFER_SIZE |
static int |
OK |
protected OutputStream |
out |
static int |
S_IRGRP |
static int |
S_IROTH |
static int |
S_IRUSR |
static int |
S_IWGRP |
static int |
S_IWOTH |
static int |
S_IWUSR |
static int |
S_IXGRP |
static int |
S_IXOTH |
static int |
S_IXUSR |
static String |
SCP_COMMAND_PREFIX
Command prefix used to identify SCP commands
|
static int |
WARNING |
log| Constructor and Description |
|---|
ScpHelper(InputStream in,
OutputStream out,
FileSystem fileSystem,
ScpTransferEventListener eventListener) |
| Modifier and Type | Method and Description |
|---|---|
void |
ack() |
static String |
getOctalPermissions(Collection<PosixFilePermission> perms) |
static String |
getOctalPermissions(Path path,
LinkOption... options) |
static Set<PosixFilePermission> |
parseOctalPermissions(String str) |
int |
readAck(boolean canEof) |
String |
readLine() |
String |
readLine(boolean canEof) |
void |
receive(Path path,
boolean recursive,
boolean shouldBeDir,
boolean preserve,
int bufferSize) |
protected void |
receive(ScpReceiveLineHandler handler) |
void |
receiveDir(String header,
Path path,
ScpTimestamp time,
boolean preserve,
int bufferSize) |
void |
receiveFile(String header,
Path path,
ScpTimestamp time,
boolean preserve,
int bufferSize) |
void |
receiveFileStream(OutputStream local,
int bufferSize) |
void |
receiveStream(String header,
ScpTargetStreamResolver resolver,
ScpTimestamp time,
boolean preserve,
int bufferSize) |
Path |
resolveLocalPath(String commandPath) |
Path |
resolveLocalPath(String basedir,
String subpath) |
void |
send(Collection<String> paths,
boolean recursive,
boolean preserve,
int bufferSize) |
protected void |
send(Path file,
boolean recursive,
boolean preserve,
int bufferSize,
LinkOption... options) |
void |
sendDir(Path path,
boolean preserve,
int bufferSize) |
void |
sendFile(Path path,
boolean preserve,
int bufferSize) |
void |
sendPaths(Collection<? extends Path> paths,
boolean recursive,
boolean preserve,
int bufferSize) |
void |
sendStream(ScpSourceStreamResolver resolver,
boolean preserve,
int bufferSize) |
static Set<PosixFilePermission> |
setOctalPermissions(Path path,
String str) |
protected void |
updateFileProperties(Path file,
Set<PosixFilePermission> perms,
ScpTimestamp time) |
public static final String SCP_COMMAND_PREFIX
public static final int OK
public static final int WARNING
public static final int ERROR
public static final int DEFAULT_COPY_BUFFER_SIZE
public static final int DEFAULT_RECEIVE_BUFFER_SIZE
public static final int DEFAULT_SEND_BUFFER_SIZE
public static final int MIN_COPY_BUFFER_SIZE
public static final int MIN_RECEIVE_BUFFER_SIZE
public static final int MIN_SEND_BUFFER_SIZE
public static final int S_IRUSR
public static final int S_IWUSR
public static final int S_IXUSR
public static final int S_IRGRP
public static final int S_IWGRP
public static final int S_IXGRP
public static final int S_IROTH
public static final int S_IWOTH
public static final int S_IXOTH
protected final FileSystem fileSystem
protected final InputStream in
protected final OutputStream out
protected final ScpTransferEventListener listener
public ScpHelper(InputStream in, OutputStream out, FileSystem fileSystem, ScpTransferEventListener eventListener)
public void receiveFileStream(OutputStream local, int bufferSize) throws IOException
IOExceptionpublic void receive(Path path, boolean recursive, boolean shouldBeDir, boolean preserve, int bufferSize) throws IOException
IOExceptionprotected void receive(ScpReceiveLineHandler handler) throws IOException
IOExceptionpublic void receiveDir(String header, Path path, ScpTimestamp time, boolean preserve, int bufferSize) throws IOException
IOExceptionpublic void receiveFile(String header, Path path, ScpTimestamp time, boolean preserve, int bufferSize) throws IOException
IOExceptionpublic void receiveStream(String header, ScpTargetStreamResolver resolver, ScpTimestamp time, boolean preserve, int bufferSize) throws IOException
IOExceptionprotected void updateFileProperties(Path file, Set<PosixFilePermission> perms, ScpTimestamp time) throws IOException
IOExceptionpublic String readLine() throws IOException
IOExceptionpublic String readLine(boolean canEof) throws IOException
IOExceptionpublic void send(Collection<String> paths, boolean recursive, boolean preserve, int bufferSize) throws IOException
IOExceptionpublic void sendPaths(Collection<? extends Path> paths, boolean recursive, boolean preserve, int bufferSize) throws IOException
IOExceptionprotected void send(Path file, boolean recursive, boolean preserve, int bufferSize, LinkOption... options) throws IOException
IOExceptionpublic Path resolveLocalPath(String basedir, String subpath) throws IOException
IOExceptionpublic Path resolveLocalPath(String commandPath) throws IOException, InvalidPathException
commandPath - The command path using the local file separatorPathIOException - If failed to resolve the pathInvalidPathException - If invalid local path valuepublic void sendFile(Path path, boolean preserve, int bufferSize) throws IOException
IOExceptionpublic void sendStream(ScpSourceStreamResolver resolver, boolean preserve, int bufferSize) throws IOException
IOExceptionpublic void sendDir(Path path, boolean preserve, int bufferSize) throws IOException
IOExceptionpublic static String getOctalPermissions(Path path, LinkOption... options) throws IOException
IOExceptionpublic static String getOctalPermissions(Collection<PosixFilePermission> perms)
public static Set<PosixFilePermission> setOctalPermissions(Path path, String str) throws IOException
IOExceptionpublic static Set<PosixFilePermission> parseOctalPermissions(String str)
public void ack()
throws IOException
IOExceptionpublic int readAck(boolean canEof)
throws IOException
IOExceptionCopyright © 2008–2015 The Apache Software Foundation. All rights reserved.