public interface Session<F> extends Closeable
Modifier and Type | Method and Description |
---|---|
void |
append(InputStream inputStream,
String destination)
Append to a file.
|
void |
close() |
default void |
dirty()
Mark this session as dirty, indicating that it should not be reused and any
delegated sessions should be taken care of before closing.
|
boolean |
exists(String path)
Check if the remote file or directory exists.
|
boolean |
finalizeRaw()
Invoke after closing the InputStream from
readRaw(String) . |
Object |
getClientInstance()
Get the underlying client library's client instance for this session.
|
String |
getHostPort()
Return the host:port pair this session is connected to.
|
boolean |
isOpen() |
F[] |
list(String path) |
String[] |
listNames(String path) |
boolean |
mkdir(String directory) |
void |
read(String source,
OutputStream outputStream) |
InputStream |
readRaw(String source)
Retrieve a remote file as a raw
InputStream . |
boolean |
remove(String path) |
void |
rename(String pathFrom,
String pathTo) |
boolean |
rmdir(String directory)
Remove a remote directory.
|
default boolean |
test()
Test the session is still alive, e.g.
|
void |
write(InputStream inputStream,
String destination) |
boolean remove(String path) throws IOException
IOException
F[] list(String path) throws IOException
IOException
void read(String source, OutputStream outputStream) throws IOException
IOException
void write(InputStream inputStream, String destination) throws IOException
IOException
void append(InputStream inputStream, String destination) throws IOException
inputStream
- the stream.destination
- the destination.IOException
- an IO Exception.boolean mkdir(String directory) throws IOException
IOException
boolean rmdir(String directory) throws IOException
directory
- The directory.IOException
- an IO exception.void rename(String pathFrom, String pathTo) throws IOException
IOException
void close()
close
in interface AutoCloseable
close
in interface Closeable
boolean isOpen()
boolean exists(String path) throws IOException
path
- the remote path.true
or false
if remote path exists or not.IOException
- an IO exception during remote interaction.String[] listNames(String path) throws IOException
IOException
InputStream readRaw(String source) throws IOException
InputStream
.source
- The path of the remote file.IOException
- Any IOException.boolean finalizeRaw() throws IOException
readRaw(String)
.
Required by some session providers.IOException
- Any IOException.Object getClientInstance()
Object
to avoid significant changes to -file, -ftp, -sftp
modules, which would be required
if we added another generic parameter. Implementations should narrow the
return type.String getHostPort()
default boolean test()
isOpen()
.default void dirty()
CachingSessionFactory.CachedSession.close()