All Projects → benas → Unix Stream

benas / Unix Stream

Licence: mit
Turn Java 8 Streams into Unix like pipelines

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Unix Stream

Dgsh
Shell supporting pipelines to and from multiple processes
Stars: ✭ 261 (+119.33%)
Mutual labels:  pipeline, unix
bash-streams-handbook
💻 Learn Bash streams, pipelines and redirection, from beginner to advanced.
Stars: ✭ 153 (+28.57%)
Mutual labels:  unix, pipeline
Rexpect
Rust port of pexpect
Stars: ✭ 110 (-7.56%)
Mutual labels:  unix
Pex Context
Modern WebGL state wrapper for PEX: allocate GPU resources (textures, buffers), setup state pipelines and passes, and combine them into commands.
Stars: ✭ 117 (-1.68%)
Mutual labels:  pipeline
The Glorious Dotfiles
A glorified personal dot files
Stars: ✭ 1,850 (+1454.62%)
Mutual labels:  unix
Nix
Rust friendly bindings to *nix APIs
Stars: ✭ 1,660 (+1294.96%)
Mutual labels:  unix
Mesabox
A collection of core system utilities written in Rust for Unix-like systems (and now Windows)
Stars: ✭ 116 (-2.52%)
Mutual labels:  unix
Makeself
A self-extracting archiving tool for Unix systems, in 100% shell script.
Stars: ✭ 1,582 (+1229.41%)
Mutual labels:  unix
Steppy
Lightweight, Python library for fast and reproducible experimentation 🔬
Stars: ✭ 119 (+0%)
Mutual labels:  pipeline
Crontab Ui
Easy and safe way to manage your crontab file
Stars: ✭ 1,786 (+1400.84%)
Mutual labels:  unix
Mg
Micro (GNU) Emacs-like text editor ❤️ public-domain
Stars: ✭ 117 (-1.68%)
Mutual labels:  unix
Ltp
Linux Test Project http://linux-test-project.github.io/
Stars: ✭ 1,654 (+1289.92%)
Mutual labels:  unix
Steeloverseer
A file watcher and development tool.
Stars: ✭ 110 (-7.56%)
Mutual labels:  pipeline
Lastbackend
System for containerized apps management. From build to scaling.
Stars: ✭ 1,536 (+1190.76%)
Mutual labels:  pipeline
Awesome Terminal Commands
An awesome resource listing and explaining various commonly used *nix commands
Stars: ✭ 109 (-8.4%)
Mutual labels:  unix
Chain.jl
A Julia package for piping a value through a series of transformation expressions using a more convenient syntax than Julia's native piping functionality.
Stars: ✭ 118 (-0.84%)
Mutual labels:  pipeline
Pwd.sh
GPG symmetric password manager
Stars: ✭ 1,468 (+1133.61%)
Mutual labels:  unix
Ugene
UGENE is free open-source cross-platform bioinformatics software
Stars: ✭ 112 (-5.88%)
Mutual labels:  pipeline
Europa
Puppet Container Registry
Stars: ✭ 114 (-4.2%)
Mutual labels:  pipeline
Dropseqpipe
A SingleCell RNASeq pre-processing snakemake workflow
Stars: ✭ 119 (+0%)
Mutual labels:  pipeline

What is UnixStream?

Gitter MIT license Maven Central Build Status Coverage Status

UnixStream is an extension of the Java 8 Stream API to process data pipelines the Unix way. It provides a set of components that mimic Unix commands (and more).

Features

  • 100% compatible with Java 8 Streams
  • Intuitive, flexible and extensible API
  • A toolbox of reusable components
  • No dependencies
  • Free and open source

How to use it?

You can use UnixStream in 3 ways:

1. Either unixify your stream and process it the unix way:

Stream<String> stream = Stream.of("foo", "bar", "bar", "baz");

UnixStream.unixify(stream)
        .grep("a")
        .sort()
        .uniq()
        .nl()
        .to(stdOut());
        
// prints:
// 1 bar
// 2 baz

2. Or write your pipelines as you read them:

// cat input.txt | grep a | sort | uniq | nl > output.txt

UnixStream.cat("input.txt")
        .pipe(grep("a"))
        .pipe(sort())
        .pipe(uniq())
        .pipe(nl())
        .to(file("output.txt"));

3. Or use functions and predicates provided by UnixStream with the standard Stream API:

Stream.of("1,foo", "2,bar")
        .filter(grep("a"))
        .map(cut(",", 2))
        .forEach(System.out::println);
        
//prints:
//bar

Where to find it?

Add the following maven dependency to your project:

<dependency>
   <groupId>io.github.benas</groupId>
   <artifactId>unix-stream</artifactId>
   <version>0.5</version>
</dependency>

Or download the jar file and add it to your application's classpath.

Components library

UnixStream provides a toolbox of reusable components that mimic Unix commands (and more). Components are inspired by the Unix philosophy and are intended to be:

  • Small
  • Portable
  • Do one thing and do it well
  • Side-effect free

Here are some of the built-in components:

You can find a complete reference of components in the wiki page.

How to extend it ?

The Stage interface represents a stage of the pipeline:

public interface Stage<I,O> {

  Stream<O> apply(Stream<I> input);

}

All built-in components are implemented as filters/transformers through this interface. You can of course implement this interface to create your own components.

Contribution

There are a lot of options for current components that are not implemented yet. You are welcome to improve existing components or add new ones to make the toolbox as rich as possible!

License

UnixStream is released under the MIT License:

The MIT License

Copyright (c) 2018, Mahmoud Ben Hassine ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].