The io.streams.limited vocabulary wraps a stream to behave as if it had only a limited number of bytes. Limiting a seekable stream creates a window of bytes that supports seeking and re-reading of bytes in that window. If it is desirable for a stream to throw an exception upon exhaustion, use the io.streams.throwing vocabulary in conjunction with this one.

Wrap a stream in a limited stream:
limited-stream


Wrap the current input-stream in a limited stream:
limited-input ( limit -- )