Package org.apache.sshd.sftp.server
Class Handle
java.lang.Object
org.apache.sshd.sftp.server.Handle
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,org.apache.sshd.common.AttributeRepository,org.apache.sshd.common.AttributeStore
- Direct Known Subclasses:
DirectoryHandle,FileHandle
public abstract class Handle
extends Object
implements Channel, org.apache.sshd.common.AttributeStore
- Author:
- Apache MINA SSHD Project
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.sshd.common.AttributeRepository
org.apache.sshd.common.AttributeRepository.AttributeKey<T> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHandle(SftpSubsystem subsystem, Path file, String handle) -
Method Summary
Modifier and TypeMethodDescriptionCollection<org.apache.sshd.common.AttributeRepository.AttributeKey<?>> voidvoidclose()<T> TcomputeAttributeIfAbsent(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key, Function<? super org.apache.sshd.common.AttributeRepository.AttributeKey<T>, ? extends T> resolver) <T> TgetAttribute(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key) intgetFile()Retrieves the raw opaque file handle, which may contain characters not safe for printing.protected SftpSubsystembooleanisOpen()<T> TremoveAttribute(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key) protected static StringConverts 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(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key, T value) protected voidprotected voidtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sshd.common.AttributeRepository
resolveAttribute
-
Constructor Details
-
Handle
-
-
Method Details
-
getSubsystem
-
signalHandleOpening
- Throws:
IOException
-
signalHandleOpen
- Throws:
IOException
-
getFile
-
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 interfaceorg.apache.sshd.common.AttributeRepository
-
getAttribute
public <T> T getAttribute(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key) - Specified by:
getAttributein interfaceorg.apache.sshd.common.AttributeRepository
-
attributeKeys
- Specified by:
attributeKeysin interfaceorg.apache.sshd.common.AttributeRepository
-
computeAttributeIfAbsent
public <T> T computeAttributeIfAbsent(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key, Function<? super org.apache.sshd.common.AttributeRepository.AttributeKey<T>, ? extends T> resolver) - Specified by:
computeAttributeIfAbsentin interfaceorg.apache.sshd.common.AttributeStore
-
setAttribute
public <T> T setAttribute(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key, T value) - Specified by:
setAttributein interfaceorg.apache.sshd.common.AttributeStore
-
removeAttribute
public <T> T removeAttribute(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key) - Specified by:
removeAttributein interfaceorg.apache.sshd.common.AttributeStore
-
clearAttributes
public void clearAttributes()- Specified by:
clearAttributesin interfaceorg.apache.sshd.common.AttributeStore
-
isOpen
public boolean isOpen() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-
toString
-
safe
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
-