Code example for ObjectInputStream

Methods: availablereadObject

0
	private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
		// we know that when deserializing this object there will be two objects in a row. 
		// the first object is the messageaddress, which will tell us if we need to de-serialize 
		// the second one.  
		 
		this.adr = (MessageAddress) in.readObject();
		if(this.adr.isForThisRobot()) {
			this.msg = (RobotMessage) in.readObject();
		} else { 
			in.skipBytes(in.available());
			this.msg = null;
		} 
	} 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE