Interface Session<F>
- Type Parameters:
- F- the target system file type.
- All Superinterfaces:
- AutoCloseable,- Closeable
- All Known Implementing Classes:
- CachingSessionFactory.CachedSession,- FtpSession,- SftpSession,- SmbSession
Common abstraction for a Session with a remote File system.
- Since:
- 2.0
- Author:
- Josh Long, Mario Gray, Mark Fisher, Oleg Zhurakousky, Gary Russell, Alen Turkovic, Artem Bilan
- 
Method SummaryModifier and TypeMethodDescriptionvoidappend(InputStream inputStream, String destination) Append to a file.voidclose()default voiddirty()Mark this session as dirty, indicating that it should not be reused and any delegated sessions should be taken care of before closing.booleanCheck if the remote file or directory exists.booleanInvoke after closing the InputStream fromreadRaw(String).Get the underlying client library's client instance for this session.Return the host:port pair this session is connected to.booleanisOpen()F[]String[]booleanvoidread(String source, OutputStream outputStream) Retrieve a remote file as a rawInputStream.booleanvoidbooleanRemove a remote directory.default booleantest()Test the session is still alive, e.g.voidwrite(InputStream inputStream, String destination) 
- 
Method Details- 
remove- Throws:
- IOException
 
- 
list- Throws:
- IOException
 
- 
read- Throws:
- IOException
 
- 
write- Throws:
- IOException
 
- 
appendAppend to a file.- Parameters:
- inputStream- the stream.
- destination- the destination.
- Throws:
- IOException- an IO Exception.
- Since:
- 4.1
 
- 
mkdir- Throws:
- IOException
 
- 
rmdirRemove a remote directory.- Parameters:
- directory- The directory.
- Returns:
- True if the directory was removed.
- Throws:
- IOException- an IO exception.
- Since:
- 4.1
 
- 
rename- Throws:
- IOException
 
- 
closevoid close()- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
- 
isOpenboolean isOpen()
- 
existsCheck if the remote file or directory exists.- Parameters:
- path- the remote path.
- Returns:
- trueor- falseif remote path exists or not.
- Throws:
- IOException- an IO exception during remote interaction.
 
- 
listNames- Throws:
- IOException
 
- 
readRawRetrieve a remote file as a rawInputStream.- Parameters:
- source- The path of the remote file.
- Returns:
- The raw inputStream.
- Throws:
- IOException- Any IOException.
- Since:
- 3.0
 
- 
finalizeRawInvoke after closing the InputStream fromreadRaw(String). Required by some session providers.- Returns:
- true if successful.
- Throws:
- IOException- Any IOException.
- Since:
- 3.0
 
- 
getClientInstanceObject getClientInstance()Get the underlying client library's client instance for this session. Returns anObjectto avoid significant changes to -file, -ftp, -sftp modules, which would be required if we added another generic parameter. Implementations should narrow the return type.- Returns:
- The client instance.
- Since:
- 4.1
 
- 
getHostPortString getHostPort()Return the host:port pair this session is connected to.- Returns:
- the host:port pair this session is connected to.
- Since:
- 5.2
 
- 
testdefault boolean test()Test the session is still alive, e.g. when checking out from a pool. The default implementation simply delegates toisOpen().- Returns:
- true if the test is successful.
- Since:
- 5.1
 
- 
dirtydefault 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.- Since:
- 5.1.2
- See Also:
 
 
-