public abstract class Handle extends java.lang.Object implements java.nio.channels.Channel, AttributeStore
AttributeRepository.AttributeKey<T>| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<AttributeRepository.AttributeKey<?>,java.lang.Object> |
attributes |
private java.util.concurrent.atomic.AtomicBoolean |
closed |
private java.nio.file.Path |
file |
private java.lang.String |
handle |
| Modifier | Constructor and Description |
|---|---|
protected |
Handle(java.nio.file.Path file,
java.lang.String handle) |
| Modifier and Type | Method and Description |
|---|---|
java.util.Collection<AttributeRepository.AttributeKey<?>> |
attributeKeys() |
void |
clearAttributes()
Removes all currently stored user-defined attributes
|
void |
close() |
<T> T |
computeAttributeIfAbsent(AttributeRepository.AttributeKey<T> key,
java.util.function.Function<? super AttributeRepository.AttributeKey<T>,? extends T> resolver)
If the specified key is not already associated with a value (or is mapped
to
null), attempts to compute its value using the given mapping
function and enters it into this map unless null. |
<T> T |
getAttribute(AttributeRepository.AttributeKey<T> key)
Returns the value of the user-defined attribute.
|
int |
getAttributesCount() |
java.nio.file.Path |
getFile() |
java.lang.String |
getFileHandle() |
boolean |
isOpen() |
<T> T |
removeAttribute(AttributeRepository.AttributeKey<T> key)
Removes the user-defined attribute
|
<T> T |
setAttribute(AttributeRepository.AttributeKey<T> key,
T value)
Sets a user-defined attribute.
|
protected void |
signalHandleOpen(SftpSubsystem subsystem) |
protected void |
signalHandleOpening(SftpSubsystem subsystem) |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitofAttributesMap, ofKeyValuePair, resolveAttributeprivate final java.util.concurrent.atomic.AtomicBoolean closed
private final java.nio.file.Path file
private final java.lang.String handle
private final java.util.Map<AttributeRepository.AttributeKey<?>,java.lang.Object> attributes
protected void signalHandleOpening(SftpSubsystem subsystem) throws java.io.IOException
java.io.IOExceptionprotected void signalHandleOpen(SftpSubsystem subsystem) throws java.io.IOException
java.io.IOExceptionpublic java.nio.file.Path getFile()
public java.lang.String getFileHandle()
public int getAttributesCount()
getAttributesCount in interface AttributeRepositorypublic <T> T getAttribute(AttributeRepository.AttributeKey<T> key)
AttributeRepositorygetAttribute in interface AttributeRepositoryT - The generic attribute typekey - The key of the attribute; must not be null.null if there is no value associated with the specified keypublic java.util.Collection<AttributeRepository.AttributeKey<?>> attributeKeys()
attributeKeys in interface AttributeRepositoryCollection snapshot of all the currently registered
attributes in the repositorypublic <T> T computeAttributeIfAbsent(AttributeRepository.AttributeKey<T> key, java.util.function.Function<? super AttributeRepository.AttributeKey<T>,? extends T> resolver)
AttributeStorenull), attempts to compute its value using the given mapping
function and enters it into this map unless null.computeAttributeIfAbsent in interface AttributeStoreT - The generic attribute typekey - The key of the attribute; must not be null.resolver - The (never null) mapping function to use if value
not already mapped. If returns null then value is not mapped to
the provided key.null if value not mapped and resolver
did not return a non-null value for itpublic <T> T setAttribute(AttributeRepository.AttributeKey<T> key, T value)
AttributeStoresetAttribute in interface AttributeStoreT - The generic attribute typekey - The key of the attribute; must not be null.value - The value of the attribute; must not be null.null if it is new.public <T> T removeAttribute(AttributeRepository.AttributeKey<T> key)
AttributeStoreremoveAttribute in interface AttributeStoreT - The generic attribute typekey - The key of the attribute; must not be null.null if no previous valuepublic void clearAttributes()
AttributeStoreclearAttributes in interface AttributeStorepublic boolean isOpen()
isOpen in interface java.nio.channels.Channelpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface java.nio.channels.Channeljava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Object