Turi Create
4.0
|
#include <core/storage/fileio/union_fstream.hpp>
Public Member Functions | |
union_fstream (std::string url, std::ios_base::openmode mode=std::ios_base::in|std::ios_base::out, std::string proxy="") | |
~union_fstream () | |
Destructor. | |
stream_type | get_type () const |
Returns the current stream type. Whether it is a HDFS, STD, or cache stream. | |
std::string | get_name () const |
size_t | file_size () |
A simple union of std::fstream and turi::hdfs::fstream. Also performs S3 downloading, uploading, and Curl downloading automatically.
Definition at line 19 of file union_fstream.hpp.
turi::union_fstream::union_fstream | ( | std::string | url, |
std::ios_base::openmode | mode = std::ios_base::in|std::ios_base::out , |
||
std::string | proxy = "" |
||
) |
Constructs a union fstream from a filename. Based on the filename (whether it begins with hdfs://, or cache://) an appropriate stream type (HDFS, STD, or CACHE) is created.
Throws an std::io_base_failure exception if fail to construct the stream.
size_t turi::union_fstream::file_size | ( | ) |
Returns the file size of the opened file. Returns (size_t)(-1) if there is no file opened, or if there is an error obtaining the file size.
std::string turi::union_fstream::get_name | ( | ) | const |
Returns the filename used to construct the union_fstream