public abstract class Handle extends Object implements Channel, AttributeStore
AttributeRepository.AttributeKey<T>
Modifier | Constructor and Description |
---|---|
protected |
Handle(SftpSubsystem subsystem,
Path file,
String handle) |
Modifier and Type | Method and Description |
---|---|
Collection<AttributeRepository.AttributeKey<?>> |
attributeKeys() |
void |
clearAttributes()
Removes all currently stored user-defined attributes
|
void |
close() |
<T> T |
computeAttributeIfAbsent(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 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() |
Path |
getFile() |
String |
getFileHandle() |
protected SftpSubsystem |
getSubsystem() |
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() |
protected void |
signalHandleOpening() |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
ofAttributesMap, ofKeyValuePair, resolveAttribute
protected Handle(SftpSubsystem subsystem, Path file, String handle)
protected SftpSubsystem getSubsystem()
protected void signalHandleOpening() throws IOException
IOException
protected void signalHandleOpen() throws IOException
IOException
public Path getFile()
public String getFileHandle()
public int getAttributesCount()
getAttributesCount
in interface AttributeRepository
public <T> T getAttribute(AttributeRepository.AttributeKey<T> key)
AttributeRepository
getAttribute
in interface AttributeRepository
T
- The generic attribute typekey
- The key of the attribute; must not be null
.null
if there is no value associated with the specified keypublic Collection<AttributeRepository.AttributeKey<?>> attributeKeys()
attributeKeys
in interface AttributeRepository
Collection
snapshot of all the currently registered attributes in the repositorypublic <T> T computeAttributeIfAbsent(AttributeRepository.AttributeKey<T> key, Function<? super AttributeRepository.AttributeKey<T>,? extends T> resolver)
AttributeStore
null
), attempts to compute
its value using the given mapping function and enters it into this map unless null
.computeAttributeIfAbsent
in interface AttributeStore
T
- 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)
AttributeStore
setAttribute
in interface AttributeStore
T
- 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)
AttributeStore
removeAttribute
in interface AttributeStore
T
- The generic attribute typekey
- The key of the attribute; must not be null
.null
if no previous valuepublic void clearAttributes()
AttributeStore
clearAttributes
in interface AttributeStore
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
IOException
Copyright © 2008–2024 The Apache Software Foundation. All rights reserved.