isOpen
FileHandle.swift:153var isOpen: Bool { get }
var isOpen: Bool { get }
import NIOCore
The core abstractions that make up SwiftNIO.
final class NIOFileHandle
Deprecated. NIOFileHandle
is a handle to an open file descriptor.
@frozen struct Bool
A value type whose instances are either true
or false
.
convenience init(_deprecatedPath path: String) throws
Open a new NIOFileHandle
. This operation is blocking.
convenience init(_deprecatedPath path: String, mode: NIOFileHandle.Mode = .read, flags: NIOFileHandle.Flags = .default) throws
Open a new NIOFileHandle
. This operation is blocking.
init(_deprecatedTakingOwnershipOfDescriptor descriptor: CInt)
Create a NIOFileHandle
taking ownership of descriptor
. You must call NIOFileHandle.close
or NIOFileHandle.takeDescriptorOwnership
before this object can be safely released.
var description: String { get }
func close() throws
func duplicate() throws -> NIOFileHandle
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 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>(_ body: (CInt) throws -> T) throws -> T
struct Flags
Flags
allows to specify additional flags to Mode
, such as permission for file creation.
struct Mode
Mode
represents file access modes.
convenience init(descriptor: CInt)
Create a NIOFileHandle
taking ownership of descriptor
. You must call NIOFileHandle.close
or NIOFileHandle.takeDescriptorOwnership
before this object can be safely released.
convenience init(path: String) throws
Open a new NIOFileHandle
. This operation is blocking.
convenience init(path: String, mode: NIOFileHandle.Mode = .read, flags: NIOFileHandle.Flags = .default) throws
Open a new NIOFileHandle
. This operation is blocking.