Instance Methodswift-nio 2.72.0NIOCore
duplicate
Duplicates this NIOFileHandle
. This means that a new NIOFileHandle
object with a new underlying file descriptor is returned. The caller takes ownership of the returned NIOFileHandle
and is responsible for closing it.
func duplicate() throws -> NIOFileHandle
Returns
A new NIOFileHandle
with a fresh underlying file descriptor but shared seek pointer.
Other members in extension
Types
struct Flags
Flags
allows to specify additional flags toMode
, such as permission for file creation.struct Mode
Mode
represents file access modes.
Type members
init(descriptor: CInt
) Create a
NIOFileHandle
taking ownership ofdescriptor
. You must callNIOFileHandle.close
orNIOFileHandle.takeDescriptorOwnership
before this object can be safely released.init(path: String
) throws Open a new
NIOFileHandle
. This operation is blocking.init(path: String, mode: Mode, flags: Flags
) throws Open a new
NIOFileHandle
. This operation is blocking.
Instance members
var description: String
var isOpen: Bool
func close(
) throws func takeDescriptorOwnership(
) throws -> CInt Take the ownership of the underlying file descriptor. This is similar to
close()
but the underlying file descriptor remains open. The caller is responsible for closing the file descriptor by some other means.func withUnsafeFileDescriptor<T>((CInt) throws -> T
) throws -> T