Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

virtual String Impala::Util::IOBufferFile::ReadLine (  )  [inline, virtual]

only for ascii (not binary) entities

Reimplemented from Impala::Util::IOBuffer.

Definition at line 118 of file IOBufferFile.h.

References Impala::Util::IOBuffer::Available(), FSeek(), FTell(), Impala::Util::IOBuffer::GetPosition(), mFile, mUseMemory, Impala::Util::IOBuffer::ReadLine(), and SetPosition().

00119     {
00120         if (mUseMemory)
00121             return IOBuffer::ReadLine();
00122 
00123         // todo : this is a very inefficient implementation
00124         Int64 available = Available();
00125         Int64 maxLineSize = 1048576; // 1 Mb, todo : give user control
00126         if (available < maxLineSize)
00127             maxLineSize = available + 1; // extra space for '\0'
00128         // RvB: In debug mode this caused waiting time of up to 8 minutes
00129         //char* buf = new char[maxLineSize];
00130         static char buf[1024 * 1024];
00131         FSeek(mFile, GetPosition(), SEEK_SET);
00132         fgets(buf, maxLineSize, mFile);
00133         SetPosition(FTell(mFile));
00134         for (int i=0 ; i<maxLineSize ; i++)
00135         {
00136             if ((buf[i] == '\r') || (buf[i] == '\n'))
00137             {
00138                 buf[i] = '\0';
00139                 break;
00140             }
00141         }
00142         String res(buf);
00143         //delete buf;
00144         return res;
00145     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:24:16 2011 for ImpalaSrc by  doxygen 1.5.1