| 32 | class SingleFileSplit : public InputSplit { |
| 33 | public: |
| 34 | explicit SingleFileSplit(const char *fname) |
| 35 | : use_stdin_(false), buffer_size_(kBufferSize), |
| 36 | chunk_begin_(NULL), chunk_end_(NULL) { |
| 37 | if (!std::strcmp(fname, "stdin")) { |
| 38 | #ifndef DMLC_STRICT_CXX98_ |
| 39 | use_stdin_ = true; fp_ = stdin; |
| 40 | #endif |
| 41 | } |
| 42 | if (!use_stdin_) { |
| 43 | #if DMLC_USE_FOPEN64 |
| 44 | fp_ = fopen64(fname, "rb"); |
| 45 | #else |
| 46 | fp_ = fopen(fname, "rb"); |
| 47 | #endif |
| 48 | CHECK(fp_ != NULL) << "SingleFileSplit: fail to open " << fname; |
| 49 | } |
| 50 | buffer_.resize(kBufferSize); |
| 51 | } |
| 52 | virtual ~SingleFileSplit(void) { |
| 53 | if (!use_stdin_) std::fclose(fp_); |
| 54 | } |
nothing calls this directly
no outgoing calls
no test coverage detected