All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.venky.core.io.StringReader Maven / Gradle / Ivy

package com.venky.core.io;

import java.io.IOException;

import com.venky.core.string.StringUtil;

public class StringReader extends java.io.StringReader{

	public StringReader(){ 
		this("");
	}
	private int length = 0;  
	public StringReader(String s) {
		super(s);
		length = s.length();
	}

	public int length(){
		return length;
	}
	@Override
	public boolean markSupported() {
		return false;
	}

	@Override
	public void mark(int readAheadLimit) throws IOException {
		throw new IOException("mark not supported");
	}

	@Override
	public void close() {
		try {
			super.reset();
		}catch(IOException ex) {
			//
		}
	}
	
	public boolean equals(Object o){
		if (o == null){
			return false;
		}
		if (!(o instanceof StringReader)){
			return false;
		}
		StringReader other = (StringReader)o;
		return StringUtil.read(this).equals(StringUtil.read(other));
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy