package com.seeingwithc.io;

import java.io.*;

public class UnicodeIgnoreByteReader extends InputStreamReader {
	
	public UnicodeIgnoreByteReader(InputStream in)
	{
		super(in);
	}
	
	public UnicodeIgnoreByteReader(InputStream in, String encoding)
					throws UnsupportedEncodingException
	{
		super(in,encoding);
	}
	
	public int read(char ac[], int i, int j) throws IOException
	{
		if (i<0 || i>ac.length || j<0 || i+j>ac.length || i+j<0)
			throw new IndexOutOfBoundsException();
		char hold[] = new char[2*j];
		int ret = super.read(hold,0,2*j);
		if (ret == -1)
			return -1;
		for (int count=0;count<j && count<ret/2;count++)
			ac[i+count]=hold[2*count];
		return ret/2;
	}
}
