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>
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedHandle(SftpSubsystem subsystem, Path file, String handle)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<AttributeRepository.AttributeKey<?>>attributeKeys()voidclearAttributes()Removes all currently stored user-defined attributesvoidclose()<T> TcomputeAttributeIfAbsent(AttributeRepository.AttributeKey<T> key, Function<? super AttributeRepository.AttributeKey<T>,? extends T> resolver)If the specified key is not already associated with a value (or is mapped tonull), attempts to compute its value using the given mapping function and enters it into this map unlessnull.<T> TgetAttribute(AttributeRepository.AttributeKey<T> key)Returns the value of the user-defined attribute.intgetAttributesCount()PathgetFile()StringgetFileHandle()protected SftpSubsystemgetSubsystem()booleanisOpen()<T> TremoveAttribute(AttributeRepository.AttributeKey<T> key)Removes the user-defined attribute<T> TsetAttribute(AttributeRepository.AttributeKey<T> key, T value)Sets a user-defined attribute.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()
-
getAttributesCount
public int getAttributesCount()
- Specified by:
getAttributesCountin interfaceAttributeRepository- Returns:
- Current number of user-defined attributes stored in the repository
-
getAttribute
public <T> T getAttribute(AttributeRepository.AttributeKey<T> key)
Description copied from interface:AttributeRepositoryReturns the value of the user-defined attribute.- Specified by:
getAttributein interfaceAttributeRepository- Type Parameters:
T- The generic attribute type- Parameters:
key- The key of the attribute; must not benull.- Returns:
nullif there is no value associated with the specified key
-
attributeKeys
public Collection<AttributeRepository.AttributeKey<?>> attributeKeys()
- Specified by:
attributeKeysin interfaceAttributeRepository- Returns:
- A
Collectionsnapshot of all the currently registered attributes in the repository
-
computeAttributeIfAbsent
public <T> T computeAttributeIfAbsent(AttributeRepository.AttributeKey<T> key, Function<? super AttributeRepository.AttributeKey<T>,? extends T> resolver)
Description copied from interface:AttributeStoreIf the specified key is not already associated with a value (or is mapped tonull), attempts to compute its value using the given mapping function and enters it into this map unlessnull.- Specified by:
computeAttributeIfAbsentin interfaceAttributeStore- Type Parameters:
T- The generic attribute type- Parameters:
key- The key of the attribute; must not benull.resolver- The (nevernull) mapping function to use if value not already mapped. If returnsnullthen value is not mapped to the provided key.- Returns:
- The resolved value -
nullif value not mapped and resolver did not return a non-nullvalue for it
-
setAttribute
public <T> T setAttribute(AttributeRepository.AttributeKey<T> key, T value)
Description copied from interface:AttributeStoreSets a user-defined attribute.- Specified by:
setAttributein interfaceAttributeStore- Type Parameters:
T- The generic attribute type- Parameters:
key- The key of the attribute; must not benull.value- The value of the attribute; must not benull.- Returns:
- The old value of the attribute;
nullif it is new.
-
removeAttribute
public <T> T removeAttribute(AttributeRepository.AttributeKey<T> key)
Description copied from interface:AttributeStoreRemoves the user-defined attribute- Specified by:
removeAttributein interfaceAttributeStore- Type Parameters:
T- The generic attribute type- Parameters:
key- The key of the attribute; must not benull.- Returns:
- The removed value;
nullif no previous value
-
clearAttributes
public void clearAttributes()
Description copied from interface:AttributeStoreRemoves all currently stored user-defined attributes- Specified by:
clearAttributesin interfaceAttributeStore
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-