xrootd
Public Member Functions | Private Attributes | List of all members
XrdCl::ZipArchiveReader Class Reference

#include <XrdClZipArchiveReader.hh>

Public Member Functions

 ZipArchiveReader (File &archive)
 
virtual ~ZipArchiveReader ()
 Destructor. More...
 
XRootDStatus Open (const std::string &url, ResponseHandler *handler, uint16_t timeout=0)
 
XRootDStatus Open (const std::string &url, uint16_t timeout=0)
 Synchronous open of a given ZIP archive for reading. More...
 
XRootDStatus Read (const std::string &filename, uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0)
 
XRootDStatus Read (const std::string &filename, uint64_t offset, uint32_t size, void *buffer, uint32_t &bytesRead, uint16_t timeout=0)
 Sync read. More...
 
XRootDStatus Bind (const std::string &filename)
 Binds the reader to a file inside the archive. More...
 
void Unbind ()
 Unbinds the reader from a file. More...
 
XRootDStatus Read (uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0)
 Async bound read. More...
 
XRootDStatus Read (uint64_t offset, uint32_t size, void *buffer, uint32_t &bytesRead, uint16_t timeout=0)
 Sync bound read. More...
 
XRootDStatus List (DirectoryList *&list)
 Sync list. More...
 
XRootDStatus Close (ResponseHandler *handler, uint16_t timeout=0)
 
XRootDStatus Close (uint16_t timeout=0)
 Sync close. More...
 
XRootDStatus GetSize (const std::string &filename, uint64_t &size) const
 
XRootDStatus GetSize (uint64_t &size) const
 
bool IsOpen () const
 Check if the archive is open. More...
 
XRootDStatus ZCRC32 (const std::string &filename, std::string &checksum)
 The CRC32 checksum as in the ZIP archive. More...
 
XRootDStatus ZCRC32 (std::string &checksum)
 The CRC32 checksum as in the ZIP archive (bound version) More...
 

Private Attributes

ZipArchiveReaderImpl * pImpl
 Pointer to the implementation. More...
 

Detailed Description

A wrapper class for the XrdCl::File.

It is an abstraction for a ZIP file containing multiple sub-files. The class does not provide any unzip utilities, it just readjusts the offset so a respective file inside of the archive can be read. It is meant for ZIP archives containing uncompressed root files, so a single file can be accessed without downloading the whole archive.

Constructor & Destructor Documentation

◆ ZipArchiveReader()

XrdCl::ZipArchiveReader::ZipArchiveReader ( File archive)

Constructor.

Wraps up the File object

◆ ~ZipArchiveReader()

virtual XrdCl::ZipArchiveReader::~ZipArchiveReader ( )
virtual

Destructor.

Member Function Documentation

◆ Bind()

XRootDStatus XrdCl::ZipArchiveReader::Bind ( const std::string &  filename)

Binds the reader to a file inside the archive.

◆ Close() [1/2]

XRootDStatus XrdCl::ZipArchiveReader::Close ( ResponseHandler handler,
uint16_t  timeout = 0 
)

Async close.

Parameters
handler: the handler for the async operation
timeout: the timeout of the async operation
Returns
: OK on success, error otherwise

◆ Close() [2/2]

XRootDStatus XrdCl::ZipArchiveReader::Close ( uint16_t  timeout = 0)

Sync close.

◆ GetSize() [1/2]

XRootDStatus XrdCl::ZipArchiveReader::GetSize ( const std::string &  filename,
uint64_t &  size 
) const

Gets the size of the given file

Parameters
filename: the name of the file
Returns
: the size of the file as in CDFH record

◆ GetSize() [2/2]

XRootDStatus XrdCl::ZipArchiveReader::GetSize ( uint64_t &  size) const

Gets the size of the bound file

Returns
: the size of the file as in CDFH record

◆ IsOpen()

bool XrdCl::ZipArchiveReader::IsOpen ( ) const

Check if the archive is open.

◆ List()

XRootDStatus XrdCl::ZipArchiveReader::List ( DirectoryList *&  list)

Sync list.

◆ Open() [1/2]

XRootDStatus XrdCl::ZipArchiveReader::Open ( const std::string &  url,
ResponseHandler handler,
uint16_t  timeout = 0 
)

Asynchronous open of a given ZIP archive for reading.

During the open, the End-of-central-directory record and the Central-directory-file-headers records are being read and parsed.

If the ZIP archive is smaller than the maximum size of the EOCD record the whole archive is being down- loaded and kept in local memory.

Parameters
url: URL of the archive
handler: the handler for the async operation
timeout: the timeout of the async operation
Returns
: OK on success, error otherwise

◆ Open() [2/2]

XRootDStatus XrdCl::ZipArchiveReader::Open ( const std::string &  url,
uint16_t  timeout = 0 
)

Synchronous open of a given ZIP archive for reading.

◆ Read() [1/4]

XRootDStatus XrdCl::ZipArchiveReader::Read ( const std::string &  filename,
uint64_t  offset,
uint32_t  size,
void *  buffer,
ResponseHandler handler,
uint16_t  timeout = 0 
)

Async read.

Parameters
filename: name of the file that will the readout
offset: offset (relative for the given file)
size: size of the buffer
buffer: the readout buffer
handler: the handler for the async operation
timeout: the timeout of the async operation
Returns
: OK on success, error otherwise

◆ Read() [2/4]

XRootDStatus XrdCl::ZipArchiveReader::Read ( const std::string &  filename,
uint64_t  offset,
uint32_t  size,
void *  buffer,
uint32_t &  bytesRead,
uint16_t  timeout = 0 
)

Sync read.

◆ Read() [3/4]

XRootDStatus XrdCl::ZipArchiveReader::Read ( uint64_t  offset,
uint32_t  size,
void *  buffer,
ResponseHandler handler,
uint16_t  timeout = 0 
)

Async bound read.

◆ Read() [4/4]

XRootDStatus XrdCl::ZipArchiveReader::Read ( uint64_t  offset,
uint32_t  size,
void *  buffer,
uint32_t &  bytesRead,
uint16_t  timeout = 0 
)

Sync bound read.

◆ Unbind()

void XrdCl::ZipArchiveReader::Unbind ( )

Unbinds the reader from a file.

◆ ZCRC32() [1/2]

XRootDStatus XrdCl::ZipArchiveReader::ZCRC32 ( const std::string &  filename,
std::string &  checksum 
)

The CRC32 checksum as in the ZIP archive.

◆ ZCRC32() [2/2]

XRootDStatus XrdCl::ZipArchiveReader::ZCRC32 ( std::string &  checksum)

The CRC32 checksum as in the ZIP archive (bound version)

Member Data Documentation

◆ pImpl

ZipArchiveReaderImpl* XrdCl::ZipArchiveReader::pImpl
private

Pointer to the implementation.


The documentation for this class was generated from the following file: