OpenMS
Bzip2InputStream.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: David Wojnar $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <xercesc/util/BinInputStream.hpp>
12 #include <xercesc/util/PlatformUtils.hpp>
14 
15 
16 namespace OpenMS
17 {
18  class String;
23  class OPENMS_DLLAPI Bzip2InputStream :
24  public xercesc::BinInputStream
25  {
26 public:
28  explicit Bzip2InputStream(const String& file_name);
29 
30  explicit Bzip2InputStream(const char* const file_name);
31 
32 
34  ~Bzip2InputStream() override;
35 
37  bool getIsOpen() const;
38 
44  XMLFilePos curPos() const override;
45 
57  XMLSize_t readBytes(XMLByte* const to_fill, const XMLSize_t max_to_read) override;
58 
68  const XMLCh* getContentType() const override;
69 
70 
71 private:
76 
77  //not implemented
81  };
82 
83  inline XMLFilePos Bzip2InputStream::curPos() const
84  {
85  return file_current_index_;
86  }
87 
88  inline bool Bzip2InputStream::getIsOpen() const
89  {
90  return bzip2_->isOpen();
91  }
92 
93 } // namespace OpenMS
94 
Decompresses files which are compressed in the bzip2 format (*.bz2)
Definition: Bzip2Ifstream.h:21
bool isOpen() const
returns whether a file is open.
Definition: Bzip2Ifstream.h:87
Implements the BinInputStream class of the xerces-c library in order to read bzip2 compressed XML fil...
Definition: Bzip2InputStream.h:25
Bzip2InputStream(const Bzip2InputStream &stream)
bool getIsOpen() const
returns true if file is open
Definition: Bzip2InputStream.h:88
const XMLCh * getContentType() const override
returns 0
XMLSize_t file_current_index_
current index of the actual file
Definition: Bzip2InputStream.h:75
Bzip2InputStream & operator=(const Bzip2InputStream &stream)
Bzip2InputStream(const String &file_name)
Constructor.
Bzip2InputStream(const char *const file_name)
~Bzip2InputStream() override
Destructor.
XMLSize_t readBytes(XMLByte *const to_fill, const XMLSize_t max_to_read) override
writes bytes into buffer from file
XMLFilePos curPos() const override
returns the current position in the file
Definition: Bzip2InputStream.h:83
Bzip2Ifstream * bzip2_
pointer to an compression stream
Definition: Bzip2InputStream.h:73
A more convenient string class.
Definition: String.h:34
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19