[#BloombergLP-bdls-FdStreamBuf_FileHandler] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdls.adoc[bdls]::FdStreamBuf_FileHandler :relfileprefix: ../../ :mrdocs: Private helper that isolates file operations from `FdStreamBuf`. == Synopsis Declared in `<bdls_fdstreambuf.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class FdStreamBuf_FileHandler; ---- == Description This private helper class isolates direct operations on files from the `FdStreamBuf` class; it is a thin wrapper around `FilesystemUtil`. One service this class provides is converting between an in‐process ` ` and its corresponding on‐file `\r ` when writing to or reading from a Windows text file. On `reset` an object of this type is associated with a supplied file descriptor, after which it can do simple operations on that file descriptor in the service of a `FdStreamBuf`. == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/2constructor.adoc[`FdStreamBuf_FileHandler`] [.small]#[constructor]# | Create a file handler that is not associated with any file descriptor. Note that `isOpened` will be `false` on the newly created object. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/2destructor.adoc[`~FdStreamBuf_FileHandler`] [.small]#[destructor]# | Destroy this file handler. If `willCloseOnReset` is `true`, close any file descriptor associated with this object. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/clear.adoc[`clear`] | Release any file descriptor associated with this file handler. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/fileDescriptor.adoc[`fileDescriptor`] | Return the file descriptor associated with this object, if `isOpened` is `true`, and ‐1 otherwise. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/fileSize.adoc[`fileSize`] | Return the size of the file associated with this file handler, or 0 if it is associated with a device other than a regular file (e.g., a device or directory). | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/getOffset.adoc[`getOffset`] | Return the on‐disk size of the byte range `[first, last)]`. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/isInBinaryMode.adoc[`isInBinaryMode`] | Return `false` if on Windows and the file is opened in text mode, and `true` otherwise. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/isOpened.adoc[`isOpened`] | Return `true` if this file handler is currently associated with a file descriptor, and `false` otherwise. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/isRegularFile.adoc[`isRegularFile`] | Return whether this handler's file descriptor refers to a regular file. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/mmap.adoc[`mmap`] | Map a file section into read‐only memory. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/openMode.adoc[`openMode`] | Return the `ios_base` mode bits for this file handler. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/read.adoc[`read`] | Read `numBytes` from the file descriptor into `buffer`. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/release.adoc[`release`] | Disassociate this file handler from its file descriptor without closing it. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/reset.adoc[`reset`] | Associate this object with the specified file descriptor. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/seek.adoc[`seek`] | Set the file position associated with this object according to the specified `offset` and `dir` behavior. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/setWillCloseOnReset.adoc[`setWillCloseOnReset`] | Set whether this handler closes its file descriptor on reset. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/unmap.adoc[`unmap`] | Unmap the memory range starting at `mappedMemory`. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/willCloseOnReset.adoc[`willCloseOnReset`] | Return whether the associated file descriptor will be closed on reset. | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/write.adoc[`write`] | Write `numBytes` from `buffer` to the file descriptor. |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdls/FdStreamBuf_FileHandler/pageSize.adoc[`pageSize`] | Return the operating system's page size. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#