Skip to content

Some extra integrations to make using java.io easier from Scala

Notifications You must be signed in to change notification settings

joshlemer/ScalaJavaIoExtras

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Io Extras

This is a library for extra integrations between Scala and java.io that should make working with java.io a little bit easier in Scala.

Features

Integrations for java.io.InputStream

Usage:

import com.github.joshlemer.java_io_extras._
import java.io.InputStream

// get an InputStream from somewhere
val inputStream: InputStream = ???

// convert it to `Iterator[Byte]`
val iterator: Iterator[Byte] = InputStreamIterator(inputStream)

// convert an Iterator[Byte] to an InputStream
val inputStream2: InputStream = IteratorInputStream(iterator)

or you can use the supplied implicit converters:

import com.github.joshlemer.java_io_extras._
import com.github.joshlemer.java_io_extras.Converters._
import java.io.InputStream

// get an InputStream from somewhere
val inputStream: InputStream = ???

// convert it to `Iterator[Byte]`
val iterator: Iterator[Byte] = inputStream.iterator

// convert an Iterator[Byte] to an InputStream
val inputStream2: InputStream = iterator.inputStream

Integrations for java.io.Reader

Usage:

import com.github.joshlemer.java_io_extras._
import java.io.Reader

// get an InputStream from somewhere
val reader: InputStream = ???

// convert it to `Iterator[Byte]`
val iterator: Iterator[Byte] = InputStreamIterator(inputStream)

// convert an Iterator[Byte] to an InputStream
val inputStream2: InputStream = IteratorInputStream(iterator)

or you can use the supplied implicit converters:

import com.github.joshlemer.java_io_extras._
import com.github.joshlemer.java_io_extras.Converters._
import java.io.Reader

// get an InputStream from somewhere
val reader: Reader =

// convert it to `Iterator[Char]`
val iterator: Iterator[Char] = reader.iterator

// convert an Iterator[Char] to a Reader
val reader2: Reader = iterator.reader

About

Some extra integrations to make using java.io easier from Scala

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages