# public_project_test_6 **Repository Path**: mirrors_tomitribe/public_project_test_6 ## Basic Information - **Project Name**: public_project_test_6 - **Description**: Stream editor implemented as a series of InputStream and OutputStream filters. Like the unix sed and can manipulate an endless stream with little memory. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-26 - **Last Updated**: 2026-02-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Swizzle Stream Swizzle stream is pretty nice for finding/manipulating data in streams. It consists of two approaches: - Stream filters - wrap and rewrap input streams with input stream filters that can add/remove/replace data as it's read from the stream. - Stream lexer - variation of the above approach but with the stream details hidden exposing only 'String readToken(...)' methods to pull only desired data from a stream. One limitation is that it does not support regular expressions. All tokens are treated as string literals which keeps the searching/scanning very fast and efficient as we only need to buffer and compare a known and fixed amount of data while reading each new byte of a stream. ## Filters ### Include/Exclude The first set of filters simply include or exclude all data between two tokens in the stream. - IncludeFilterInputStream - ExcludeFilterInputStream For example if you wanted to read in an html document and include only the body, but you also want to exclude any html comments or script elements you could do the following: [source,java] ---- URL url = new URL("/web/20140620195528/http://somewhere.com/foo/bar.html"); InputStream in = new BufferedInputStream(url.openStream()); // Include only the body in = new IncludeFilterInputStream(in, "
"); // Exclude any comments in = new ExcludeFilterInputStream(in, ""); // Exclude any script sections in = new ExcludeFilterInputStream(in, "