public int read(char[] cbuf, int off, int len) throws IOException
	{
		int readAhead = 0;
		int read = 0;
		int pos = off;
		char[] readAheadBuffer = new char[BUFFER_SIZE];
		
		boolean available = true;
		while (available  &&  read < len)
		{
			available = super.read(readAheadBuffer, readAhead, 1) == 1;
			if (available)
			{
				char c = processChar(readAheadBuffer[readAhead]);
				if (state == STATE_START)
				{
					// replace control chars with space
					if (Utils.isControlChar(c))
					{	
						c = ' ';
					}	
					cbuf[pos++] = c;
					readAhead = 0;
					read++;
				}
				else if (state == STATE_ERROR)
				{
					unread(readAheadBuffer, 0, readAhead + 1);
					readAhead = 0;
				}
				else
				{
					readAhead++;
				}
			}
			else if (readAhead > 0)
			{
				// handles case when file ends within excaped sequence
				unread(readAheadBuffer, 0, readAhead);
				state = STATE_ERROR;
				readAhead = 0;
				available = true;
			}
		}
		
		
		return read > 0  ||  available ? read : -1; 
	}