only for ascii (not binary) entities
Reimplemented from Impala::Util::IOBuffer. Definition at line 98 of file IOBufferChannel.h. References Impala::Util::IOBuffer::Available(), Impala::Util::IOBuffer::GetPosition(), Read(), and SetPosition(). 00099 { 00100 // todo : this is a very inefficient implementation 00101 Int64 available = Available(); 00102 Int64 maxLineSize = 16384; // 16 Kb, todo : give user control 00103 if (available < maxLineSize) 00104 maxLineSize = available + 1; // extra space for '\0' 00105 char* buf = new char[maxLineSize]; 00106 PositionType start = GetPosition(); 00107 Int64 nrRead = Read(buf, maxLineSize); // does SetPosition 00108 Int64 i = 0; 00109 while ((i < maxLineSize) && (buf[i] != '\n')) 00110 i++; 00111 Int64 skipN = (buf[i] == '\n') ? 1 : 0; 00112 SetPosition(start + i + skipN); 00113 if (buf[i-1] == '\r') // strip '\r' if present 00114 i--; 00115 buf[i] = '\0'; 00116 String res(buf); 00117 delete buf; 00118 return res; 00119 }
Here is the call graph for this function:
|