---
name: "immapstream"
section: "3bobcat"
platform: "linux"
package: "libbobcat-dev"
version: "6.07.01-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/immapstream"
---

# immapstream(3bobcat)

Input Stream using mmap(2) through FBB::MmapBuf

## NAME

FBB::ImmapStream - Input Stream using [mmap(2)](/mmap/2.md) through FBB::MmapBuf

## SYNOPSIS

**#include \<bobcat/immapstream\>**\

Linking option: *-lbobcat*

## DESCRIPTION

**FBB::ImmapStream** objects are used to extract information from files which are made available in the virtual address space of the calling process. Using the virtual address space is handled by the class’s privately inherited **FBB::MmapBuf** (*std::streambuf* class.

By mapping files in the process’s virtual address space the time required for processing such files is usually dramatically reduced.

An *std::exception* is thrown, and an error message is written to *cerr* if the **FBB::MmapBuf** base class cannot determine the size of the specified file, or when the (un)mapping cannot be performed.

## NAMESPACE

**FBB**\
 All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace **FBB**.

## INHERITS FROM

**std::istream**, privately from **FBB::MmapBuf**.

## CONSTRUCTORS

- o

  **ImmapStream()**:\
   The default constructor merely constructs an empty **ImmapStream** object. To change it to a usable object use move assignment;

- o

  **IOmmapStream(std::string const &fname, char const \*bufSize = 0)**:\
   The constructor initializes the *ImmapStream* object for a file named *fname*.

By default bfImmapStream) uses a mapping buffer size of 10 times the standard page size, (cf. [**sysconf**(3)](/sysconf/3.md), and the member *pageSize* below). The size of the mapping buffer can also be specified using the *bufSize* parameter. To specify it use a value followed by *K, M,* or *G*, representing, resp. 1024, 1024 \* 1024, and 1024 \* 1024 \* 1024 bytes. The final buffer size is at least equal to the standard page size. When a larger value is specified the used buffer size is set to *specified / pageSize \** *pageSize*. )

The move constructor and move assignment operator are available.\
 The copy constructor and copy assignment operator are not available.

## MEMBER FUNCTIONS

All members of **std::istream** are available, as **FBB::ImmapStream** inherits from that class.

- o

  **size\_t bufSize() const**:\
   returns the used t(mmap) buffer size;

-

  - o

  **size\_t fileSize() const**:\
   returns the size of the specified file.

-

  - o

  **size\_t pageSize() const**:\
   returns the smallest page size used by t(mmap).

## EXAMPLE

An example is provided in bobcat’s source archive and gitlab repository at *bobcat/immapstream/demo*.

## FILES

*bobcat/immapstream* - defines the class interface

## SEE ALSO

[**bobcat**(7)](/bobcat/7.md), [**iommapstream**(3bobcat)](/iommapstream/3bobcat.md), [**ommapstream**(3bobcat)](/ommapstream/3bobcat.md), [**mmap**(2)](/mmap/2.md), [**mmapbuf**(3bobcat)](/mmapbuf/3bobcat.md) [**sysconf**(3)](/sysconf/3.md)

## BUGS

None Reported.

## BOBCAT PROJECT FILES

- o

  *https://fbb-git.gitlab.io/bobcat/*: gitlab project page;

Debian Bobcat project files:

- o

  *libbobcat6*: debian package containing the shared library, changelog and copyright note;

- o

  *libbobcat-dev*: debian package containing the static library, headers, manual pages, and developer info;

## BOBCAT

Bobcat is an acronym of \`Brokken’s Own Base Classes And Templates’.

## COPYRIGHT

This is free software, distributed under the terms of the GNU General Public License (GPL).

## AUTHOR

Frank B. Brokken (**f.b.brokken@rug.nl**).
