This is the principle behind positive displacement pumps, like the manual water pump for example.
What are pumps based off principle of sealed compartment pulling,pushing and expanding called?
displacement pumps