Definition at line 30 of file IOBufferFile.h. References FSeek(), FTell(), ILOG_ERROR, mFile, mReadMode, mUseMemory, Open(), Impala::Util::IOBuffer::SetBuffer(), and Impala::Util::IOBuffer::SetSize(). 00031 { 00032 mReadMode = readMode; 00033 mUseMemory = useMemory; 00034 00035 mFile = Open(filename, (mReadMode ? "rb" : "w+b")); 00036 if (!mFile) 00037 { 00038 ILOG_ERROR("Failed to open " << filename); 00039 return; 00040 } 00041 00042 if (mReadMode) 00043 { 00044 FSeek(mFile, 0, SEEK_END); 00045 PositionType size = FTell(mFile); 00046 FSeek(mFile, 0, SEEK_SET); 00047 if (mUseMemory) 00048 { 00049 unsigned char* buf = new unsigned char[size]; 00050 fread(buf, 1, size, mFile); 00051 SetBuffer(buf, size); 00052 fclose(mFile); 00053 mFile = 0; 00054 } 00055 else 00056 { 00057 SetSize(size); 00058 } 00059 } 00060 }
Here is the call graph for this function:
|