static public Object deserializeArray(InputStream in, Class elemType, int length)
		throws IOException
	{
		if (elemType==null)
			throw new NullPointerException("elemType");
		
		if (length<-1)
			throw new IllegalArgumentException("length");
		
		Object obj = deserialize(in);
		
		Class cls = obj.getClass();
		
		
		if (!cls.isArray())
			throw new InvalidObjectException("object is not an array");
		
		Class arrayElemType = cls.getComponentType();
		if (arrayElemType!=elemType)
			throw new InvalidObjectException("unexpected array component type");
				
		if (length != -1)
		{
			int arrayLength = Array.getLength(obj);
			if (arrayLength!=length)
				throw new InvalidObjectException("array length mismatch");
		}
		
		return obj;
	}