/// <summary> /// Read returns the ordinal number of the next char, or /// EOF (-1) for an end of stream. Note that the next /// code point may require *two* calls of Read(). /// </summary> /// <returns></returns> public override int Read() { // // Characters at positions // [data.offset, data.offset + data.bldr.Length) // are available in data.bldr. // if (bPos < data.MaxIndex) { // ch0 cannot be EOF return((int)data[bPos++]); } else // Read from underlying stream { // Experimental code, blocks of page size char[] chrs = new char[4096]; int count = NextBlk(chrs, 0, 4096); if (count == 0) { return(EndOfFile); } else { data.Append(chrs, count); return((int)data[bPos++]); } } }
public override int Read() { if (bPos < data.MaxIndex) { return((int)data[bPos++]); } else { char[] chrs = new char[4096]; int count = NextBlk(chrs, 0, 4096); if (count == 0) { return(EndOfFile); } else { data.Append(chrs, count); return((int)data[bPos++]); } } }
/// <summary> /// Read returns the ordinal number of the next char, or /// EOF (-1) for an end of stream. Note that the next /// code point may require *two* calls of Read(). /// </summary> /// <returns></returns> public override int Read() { int res = EndOfFile; if (EscapeCommaMode) { switch (state) { case CommaState.None: // // Characters at positions // [data.offset, data.offset + data.bldr.Length) // are available in data.bldr. // if (bPos < data.MaxIndex) { // ch0 cannot be EOF res = (int)data[bPos++]; } else // Read from underlying stream { // Experimental code, blocks of page size int count = NextBlk(chrs, 0, 4096); if (count == 0) { return(EndOfFile); } else { data.Append(chrs, count); res = (int)data[bPos++]; } } if (res == 44) { res = 32; state = CommaState.Comma; } break; case CommaState.Comma: res = 44; state = CommaState.AfterComma; break; case CommaState.AfterComma: res = 32; state = CommaState.None; break; } return(res); } if (bPos < data.MaxIndex) { // ch0 cannot be EOF return((int)data[bPos++]); } else // Read from underlying stream { // Experimental code, blocks of page size int count = NextBlk(chrs, 0, 4096); if (count == 0) { return(EndOfFile); } else { data.Append(chrs, count); return((int)data[bPos++]); } } }