Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-28 08:26:59

0001 // Licensed to the Apache Software Foundation (ASF) under one
0002 // or more contributor license agreements.  See the NOTICE file
0003 // distributed with this work for additional information
0004 // regarding copyright ownership.  The ASF licenses this file
0005 // to you under the Apache License, Version 2.0 (the
0006 // "License"); you may not use this file except in compliance
0007 // with the License.  You may obtain a copy of the License at
0008 //
0009 //   http://www.apache.org/licenses/LICENSE-2.0
0010 //
0011 // Unless required by applicable law or agreed to in writing,
0012 // software distributed under the License is distributed on an
0013 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0014 // KIND, either express or implied.  See the License for the
0015 // specific language governing permissions and limitations
0016 // under the License.
0017 
0018 #pragma once
0019 
0020 #include <cstdint>
0021 
0022 #include "arrow/io/interfaces.h"
0023 #include "arrow/util/visibility.h"
0024 
0025 namespace arrow {
0026 namespace io {
0027 
0028 // Output stream that just writes to stdout.
0029 class ARROW_EXPORT StdoutStream : public OutputStream {
0030  public:
0031   StdoutStream();
0032   ~StdoutStream() override {}
0033 
0034   Status Close() override;
0035   bool closed() const override;
0036 
0037   Result<int64_t> Tell() const override;
0038 
0039   Status Write(const void* data, int64_t nbytes) override;
0040 
0041  private:
0042   int64_t pos_;
0043 };
0044 
0045 // Output stream that just writes to stderr.
0046 class ARROW_EXPORT StderrStream : public OutputStream {
0047  public:
0048   StderrStream();
0049   ~StderrStream() override {}
0050 
0051   Status Close() override;
0052   bool closed() const override;
0053 
0054   Result<int64_t> Tell() const override;
0055 
0056   Status Write(const void* data, int64_t nbytes) override;
0057 
0058  private:
0059   int64_t pos_;
0060 };
0061 
0062 // Input stream that just reads from stdin.
0063 class ARROW_EXPORT StdinStream : public InputStream {
0064  public:
0065   StdinStream();
0066   ~StdinStream() override {}
0067 
0068   Status Close() override;
0069   bool closed() const override;
0070 
0071   Result<int64_t> Tell() const override;
0072 
0073   Result<int64_t> Read(int64_t nbytes, void* out) override;
0074 
0075   Result<std::shared_ptr<Buffer>> Read(int64_t nbytes) override;
0076 
0077  private:
0078   int64_t pos_;
0079 };
0080 
0081 }  // namespace io
0082 }  // namespace arrow