Package org.apache.sshd.sftp.server
Class Handle
- java.lang.Object
-
- org.apache.sshd.sftp.server.Handle
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,AttributeRepository,AttributeStore
- Direct Known Subclasses:
DirectoryHandle,FileHandle
public abstract class Handle extends Object implements Channel, AttributeStore
- Author:
- Apache MINA SSHD Project
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.sshd.common.AttributeRepository
AttributeRepository.AttributeKey<T extends Object>
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedHandle(SftpSubsystem subsystem, Path file, String handle)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<AttributeRepository.AttributeKey<?>>attributeKeys()voidclearAttributes()voidclose()<T> TcomputeAttributeIfAbsent(AttributeRepository.AttributeKey<T> key, Function<? super AttributeRepository.AttributeKey<T>,? extends T> resolver)<T> TgetAttribute(AttributeRepository.AttributeKey<T> key)intgetAttributesCount()PathgetFile()StringgetFileHandle()Retrieves the raw opaque file handle, which may contain characters not safe for printing.protected SftpSubsystemgetSubsystem()booleanisOpen()<T> TremoveAttribute(AttributeRepository.AttributeKey<T> key)protected static Stringsafe(String handle)Converts a file handle, which may contain non-printable characters, to a hex representation of its bytes, which is safe to write to logs or exception messages.<T> TsetAttribute(AttributeRepository.AttributeKey<T> key, T value)protected voidsignalHandleOpen()protected voidsignalHandleOpening()StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.AttributeRepository
resolveAttribute
-
-
-
-
Constructor Detail
-
Handle
protected Handle(SftpSubsystem subsystem, Path file, String handle)
-
-
Method Detail
-
getSubsystem
protected SftpSubsystem getSubsystem()
-
signalHandleOpening
protected void signalHandleOpening() throws IOException- Throws:
IOException
-
signalHandleOpen
protected void signalHandleOpen() throws IOException- Throws:
IOException
-
getFile
public Path getFile()
-
getFileHandle
public String getFileHandle()
Retrieves the raw opaque file handle, which may contain characters not safe for printing.- Returns:
- the raw file handle
-
getAttributesCount
public int getAttributesCount()
- Specified by:
getAttributesCountin interfaceAttributeRepository
-
getAttribute
public <T> T getAttribute(AttributeRepository.AttributeKey<T> key)
- Specified by:
getAttributein interfaceAttributeRepository
-
attributeKeys
public Collection<AttributeRepository.AttributeKey<?>> attributeKeys()
- Specified by:
attributeKeysin interfaceAttributeRepository
-
computeAttributeIfAbsent
public <T> T computeAttributeIfAbsent(AttributeRepository.AttributeKey<T> key, Function<? super AttributeRepository.AttributeKey<T>,? extends T> resolver)
- Specified by:
computeAttributeIfAbsentin interfaceAttributeStore
-
setAttribute
public <T> T setAttribute(AttributeRepository.AttributeKey<T> key, T value)
- Specified by:
setAttributein interfaceAttributeStore
-
removeAttribute
public <T> T removeAttribute(AttributeRepository.AttributeKey<T> key)
- Specified by:
removeAttributein interfaceAttributeStore
-
clearAttributes
public void clearAttributes()
- Specified by:
clearAttributesin interfaceAttributeStore
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-
safe
protected static String safe(String handle)
Converts a file handle, which may contain non-printable characters, to a hex representation of its bytes, which is safe to write to logs or exception messages.For historical reasons, Apache MINA sshd represents file handles as strings internally.
- Parameters:
handle- to convert- Returns:
- the printable handle string
-
-