summaryrefslogtreecommitdiffstats
path: root/fastlib/src/vespa/fastlib/io/fileinputstream.h
blob: 58662ba75c77ad86e7d4008e74649fd54ac2010e (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
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "inputstream.h"
#include <vespa/fastos/file.h>

class Fast_FileInputStream  : public Fast_InputStream
{
private:
    Fast_FileInputStream(const Fast_FileInputStream&);
    Fast_FileInputStream& operator=(const Fast_FileInputStream&);

protected:

    /** Pointer to the physical file object*/
    FastOS_FileInterface  *_theFile;

    /** File opened ok flag */
    bool  _fileOpenedOk;

public:
    Fast_FileInputStream(const char *fileName);
    ~Fast_FileInputStream();

    // Implementation of Fast_InputStream interface

    ssize_t Read(void *targetBuffer, size_t bufferSize) override;
    bool Close() override;
    ssize_t Available() override;
    ssize_t Skip(size_t) override;
};