| 1 | #include "s3common_reader.h" |
| 2 | |
| 3 | void S3CommonReader::open(const S3Params ¶ms) { |
| 4 | this->keyReader.setS3InterfaceService(s3InterfaceService); |
| 5 | |
| 6 | S3CompressionType compressionType = s3InterfaceService->checkCompressionType(params.getS3Url()); |
| 7 | |
| 8 | switch (compressionType) { |
| 9 | case S3_COMPRESSION_DEFLATE: |
| 10 | case S3_COMPRESSION_GZIP: |
| 11 | this->upstreamReader = &this->decompressReader; |
| 12 | this->decompressReader.setReader(&this->keyReader); |
| 13 | break; |
| 14 | case S3_COMPRESSION_PLAIN: |
| 15 | this->upstreamReader = &this->keyReader; |
| 16 | break; |
| 17 | default: |
| 18 | S3_CHECK_OR_DIE(false, S3RuntimeError, "unknown file type"); |
| 19 | }; |
| 20 | |
| 21 | this->upstreamReader->open(params); |
| 22 | } |
| 23 | |
| 24 | // read() attempts to read up to count bytes into the buffer. |
| 25 | // Return 0 if EOF. Throw exception if encounters errors. |
nothing calls this directly
no test coverage detected