Code example for InvalidClassException

0
		super(); 
		nwLock = lock;
		if(nwLock.channel() instanceof ReadableByteChannel)
			channel = (ReadableByteChannel)nwLock.channel();
		else 
			throw new InvalidClassException("Not a ReadableByteChannel");
	} 
 
	@Override 
	public int read() throws IOException { 
		try{ 
			ByteBuffer b = ByteBuffer.allocate(1);
			int num = 0;
			 
			nwLock.wantRead();
			 
			num=channel.read(b);
			if(num<=0){
				if(num==-1)
					nwLock.stopReading();