@staticmethod
def string(flow):
length = int(''.join(takewhile(lambda x: x != ':', flow)))
string = ''.join(islice(flow, length))
return string
-------------------------------------------------------------------------
static object String(BinaryReader flow)
{
List<byte> lengthBytes = new List<byte>();
while (true)
{
byte x = flow.ReadByte();
if (x == Tokens.Delimiter) break;
lengthBytes.Add(x);
}
string lengthString = Encoding.ASCII.GetString(lengthBytes.ToArray());
int length = int.Parse(lengthString);
byte[] result = new byte[length];
flow.Read(result, 0, length);
return result;
}
-------------------------------------------------------------------------
See the difference, feel the difference...