Skip to content

Latest commit

 

History

History
17 lines (13 loc) · 894 Bytes

trim-operation.md

File metadata and controls

17 lines (13 loc) · 894 Bytes

Trim operation

Most of the streams within WaveBeans are infinite, but at some point you may want to get some limited output to the file or something. For that purpose you need to convert the infinite stream to a finite one. This is what the trim operation is aimed for.

The trim operation has the length as a required parameter and timeUnit as an optional parameter which is by default is TimeUnit.MILLISECONDS:

// limit the stream to get 500ms out of it, milliseconds is provided by default.
stream.trim(500)
// limit the stream to get 10 seconds out of it, seconds are to be provided explicitly.
stream.trim(10, TimeUnit.SECONDS)