io.github.tsegismont:streamutils

A set of utilities for Vert.x streams.

License

License

GroupId

GroupId

io.github.tsegismont
ArtifactId

ArtifactId

streamutils
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

io.github.tsegismont:streamutils
A set of utilities for Vert.x streams.
Project URL

Project URL

https://github.com/tsegismont/streamutils
Source Code Management

Source Code Management

https://github.com/tsegismont/streamutils

Download streamutils

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.tsegismont/streamutils/ -->
<dependency>
    <groupId>io.github.tsegismont</groupId>
    <artifactId>streamutils</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.tsegismont/streamutils/
implementation 'io.github.tsegismont:streamutils:1.0.0'
// https://jarcasting.com/artifacts/io.github.tsegismont/streamutils/
implementation ("io.github.tsegismont:streamutils:1.0.0")
'io.github.tsegismont:streamutils:jar:1.0.0'
<dependency org="io.github.tsegismont" name="streamutils" rev="1.0.0">
  <artifact name="streamutils" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.tsegismont', module='streamutils', version='1.0.0')
)
libraryDependencies += "io.github.tsegismont" % "streamutils" % "1.0.0"
[io.github.tsegismont/streamutils "1.0.0"]

Dependencies

compile (2)

Group / Artifact Type Version
io.vertx : vertx-core jar
org.jetbrains.kotlin : kotlin-stdlib Optional jar 1.3.50

test (5)

Group / Artifact Type Version
junit : junit jar 4.12
io.vertx : vertx-core test-jar
org.codehaus.groovy : groovy jar 2.5.8
io.vertx : vertx-lang-groovy jar
io.vertx : vertx-lang-kotlin jar

Project Modules

There are no modules declared in this project.

Vert.x Streams utilities

Build Status

A set of utilities for Vert.x streams.

Purpose

Provide tools for simple transformations of stream data (e.g. map, filter, skip).

For anything beyond simple transformations, consider using a Reactive Streams implementation like RxJava.

Dependency setup

Maven

<dependency>
  <groupId>io.github.tsegismont</groupId>
  <artifactId>streamutils</artifactId>
  <version>1.0.0</version>
</dependency>

Gradle Kotlin DSL

implementation("io.github.tsegismont:streamutils:1.0.0")

Gradle Groovy DSL:

implementation 'io.github.tsegismont:streamutils:1.0.0'

Usage

Java

Import the io.github.tsegismont.streamutils.Streams class.

Then use operators to transform streams. Here’s an io.vertx.core.file.AsyncFile transformation example:

// Splits file content into lines
RecordParser parser = RecordParser.newDelimited("\n", asyncFile);
// Transform line bytes to String
ReadStream<String> lines = Streams.map(parser, Buffer::toString);
// Get the line length
ReadStream<Integer> sizes = Streams.map(lines, String::length);
// Skip the first 50 lines
ReadStream<Integer> skipped = Streams.skip(sizes, 50);
// Limit result to 150 lines
ReadStream<Integer> result = Streams.limit(skipped, 150);

Groovy

This library comes with a Groovy extension module that adds operators to Vert.x streams. Here’s an io.vertx.core.file.AsyncFile transformation example:

// Splits file content into lines
def parser = RecordParser.newDelimited("\n", asyncFile)

def result = parser
  // Transform line bytes to String
  .map { Buffer buffer -> buffer.toString() }
  // Get the line length
  .map { String line -> line.length() }
  // Skip the first 50 lines
  .skip(50)
  // Limit result to 150 lines
  .limit(150)

Kotlin

This library comes with Kotlin extension functions that add operators to Vert.x streams. Here’s an io.vertx.core.file.AsyncFile transformation example:

// Splits file content into lines
val parser = RecordParser.newDelimited("\n", asyncFile)

val result = parser
  // Transform line bytes to String
  .map(Buffer::toString)
  // Get the line length
  .map(String::length)
  // Skip the first 50 lines
  .skip(50)
  // Limit result to 150 lines
  .limit(150)

License

Apache License version 2.0.

Versions

Version
1.0.0