summaryrefslogtreecommitdiffstats
path: root/fastlib/src/vespa/fastlib/io/filterinputstream.h
blob: 20a9e544fb7dfdee0bd8b9ee70e243fd287e3b41 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
*******************************************************************************
*
* @author Stein Hardy Danielsen
* @date            Creation date: 2000-1-14
*
* Generic filter input stream
*
* Copyright (c)  : 1997-1999 Fast Search & Transfer ASA
*                  ALL RIGHTS RESERVED
*
******************************************************************************/
#pragma once

#include "inputstream.h"

class Fast_FilterInputStream : public Fast_InputStream
{
private:

    // Prevent use of:
    Fast_FilterInputStream(void);
    Fast_FilterInputStream(Fast_FilterInputStream &);
    Fast_FilterInputStream &operator=(const Fast_FilterInputStream &);


protected:

    /** The stream to forward data to */
    Fast_InputStream *_in;


public:

    // Constructors
    Fast_FilterInputStream(Fast_InputStream &in) : _in(&in) {}

    ~Fast_FilterInputStream() {};

    ssize_t Available()              override  { return _in->Available();      }
    bool    Close()                  override  { return _in->Close();          }
    ssize_t Skip(size_t skipNBytes)  override { return _in->Skip(skipNBytes); }

    ssize_t Read(void *targetBuffer, size_t length) override {
        return _in->Read(targetBuffer, length);
    }
};