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
  • Constructor Details

  • Method Details

    • 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:
      getAttributesCount in interface org.apache.sshd.common.AttributeRepository
    • getAttribute

      public <T> T getAttribute(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key)
      Specified by:
      getAttribute in interface org.apache.sshd.common.AttributeRepository
    • attributeKeys

      public Collection<org.apache.sshd.common.AttributeRepository.AttributeKey<?>> attributeKeys()
      Specified by:
      attributeKeys in interface org.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:
      computeAttributeIfAbsent in interface org.apache.sshd.common.AttributeStore
    • setAttribute

      public <T> T setAttribute(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key, T value)
      Specified by:
      setAttribute in interface org.apache.sshd.common.AttributeStore
    • removeAttribute

      public <T> T removeAttribute(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key)
      Specified by:
      removeAttribute in interface org.apache.sshd.common.AttributeStore
    • clearAttributes

      public void clearAttributes()
      Specified by:
      clearAttributes in interface org.apache.sshd.common.AttributeStore
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface Channel
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Channel
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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