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

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

only for ascii (not binary) entities

Reimplemented from Impala::Util::IOBuffer.

Definition at line 99 of file IOBufferChannel.h.

References Impala::Util::IOBuffer::Available(), Impala::Util::IOBuffer::GetPosition(), Read(), and SetPosition().

00100     {
00101         // todo : this is a very inefficient implementation
00102         Int64 available = Available();
00103         Int64 maxLineSize = 16384; // 16 Kb, todo : give user control
00104         if (available < maxLineSize)
00105             maxLineSize = available + 1; // extra space for '\0'
00106         char* buf = new char[maxLineSize];
00107         PositionType start = GetPosition();
00108         Int64 nrRead = Read(buf, maxLineSize); // does SetPosition
00109         Int64 i = 0;
00110         while ((i < maxLineSize) && (buf[i] != '\n'))
00111             i++;
00112         Int64 skipN = (buf[i] == '\n') ? 1 : 0;
00113         SetPosition(start + i + skipN);
00114         if ((i > 0) && (buf[i-1] == '\r')) // strip '\r' if present
00115             i--;
00116         buf[i] = '\0';
00117         String res(buf);
00118         delete buf;
00119         return res;
00120     }

Here is the call graph for this function:


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