Turi Create  4.0
turi::union_fstream Class Reference

#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 ()
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ union_fstream()

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.

Member Function Documentation

◆ file_size()

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.

◆ get_name()

std::string turi::union_fstream::get_name ( ) const

Returns the filename used to construct the union_fstream


The documentation for this class was generated from the following file: