LibTIFF 4.7.2
TIFF library public API and implementation reference
Loading...
Searching...
No Matches
Functions
C++ stream interface

Attach TIFF handles to caller-owned seekable C++ streams. More...

Collaboration diagram for C++ stream interface:

Functions

TIFF * TIFFStreamOpen (const char *name, std::ostream *os)
 Open a TIFF writer over a caller-owned C++ stream.
 
TIFF * TIFFStreamOpen (const char *name, std::istream *is)
 Open a TIFF reader over a caller-owned C++ stream.
 

Detailed Description

Attach TIFF handles to caller-owned seekable C++ streams.

Function Documentation

◆ TIFFStreamOpen() [1/2]

TIFF * TIFFStreamOpen ( const char *  name,
std::istream *  is 
)
extern

Open a TIFF reader over a caller-owned C++ stream.

Creates a library-owned adapter around a borrowed seekable stream. The stream must outlive the TIFF handle and any explicit adapter-release call. Use a binary stream positioned at zero for supported operation; nonzero- origin adapter limitations are described in Current implementation limits.

Opens in rm mode and reads the first TIFF directory. Mapping is disabled, and the write callback does not write. Reads and seeks change position and stream status. TIFFClose() deletes the adapter but leaves the stream open.

A normal NULL return releases the adapter without destroying the stream, but does not restore the stream position or flags. Library diagnostics report TIFF errors. C++ allocation/stream exceptions propagate; this implementation supplies no exception cleanup/rollback guarantee. Use streams with exceptions disabled when relying on status- based failure handling. TIFFCleanup() alone does not invoke the adapter close callback; save and invoke it explicitly if bypassing TIFFClose().

Parameters
[in]nameNon-NULL diagnostic name; copied into the handle.
[in,out]isNon-NULL caller-owned, seekable binary input stream.
Returns
An owned TIFF handle for TIFFClose(), or NULL on an ordinary library failure. Exceptions are not converted to NULL.

Definition at line 673 of file tif_stream.cxx.

References _tiffStreamOpen().

Here is the call graph for this function:

◆ TIFFStreamOpen() [2/2]

TIFF * TIFFStreamOpen ( const char *  name,
std::ostream *  os 
)
extern

Open a TIFF writer over a caller-owned C++ stream.

Creates a library-owned adapter around a borrowed seekable stream. The stream must outlive the TIFF handle and any explicit adapter-release call. Use a binary stream positioned at zero for supported operation; nonzero- origin adapter limitations are described in Current implementation limits.

Opens in wm mode, initialising a classic TIFF header at the stream origin. Output callbacks cannot read; operations requiring readback are unsupported. For an initially empty string stream with a failing tellp(), the wrapper may write a dummy null byte and seek to zero before opening. Opening and later operations can change bytes, position, and stream status. TIFFClose() deletes the adapter but neither closes the stream nor explicitly calls ostream::flush(); flush or close the caller-owned stream as needed after TIFFFlush()/TIFFClose().

A normal NULL return releases the adapter without destroying the stream, but does not roll back stream bytes, position, or flags. Library diagnostics report TIFF errors. C++ allocation/stream exceptions propagate; this implementation supplies no exception cleanup/rollback guarantee. Use streams with exceptions disabled when relying on status- based failure handling. TIFFCleanup() alone does not invoke the adapter close callback; save and invoke it explicitly if bypassing TIFFClose().

Parameters
[in]nameNon-NULL diagnostic name; copied into the handle.
[in,out]osNon-NULL caller-owned, seekable binary output stream.
Returns
An owned TIFF handle for TIFFClose(), or NULL on an ordinary library failure. Exceptions are not converted to NULL.

Definition at line 657 of file tif_stream.cxx.

References _tiffStreamOpen().

Here is the call graph for this function: