-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
77 changed files
with
605 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,8 @@ | ||
rules = [ | ||
Disable | ||
DisableSyntax | ||
ExplicitResultTypes | ||
LeakingImplicitClassVal | ||
NoAutoTupling | ||
NoValInForComprehension | ||
OrganizeImports | ||
ProcedureSyntax | ||
RemoveUnused | ||
] | ||
|
||
Disable { | ||
ifSynthetic = [ | ||
"scala/Option.option2Iterable" | ||
"scala/Predef.any2stringadd" | ||
] | ||
} | ||
|
||
OrganizeImports { | ||
# Allign with IntelliJ IDEA so that they don't fight each other | ||
groupedImports = Merge | ||
} | ||
|
||
RemoveUnused { | ||
imports = false // handled by OrganizeImports | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
1 change: 0 additions & 1 deletion
1
...in/scala-2/zio/nio/channels/package.scala → ...in/scala-2/zio/nio/channels/package.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...in/scala-3/zio/nio/channels/package.scala → ...in/scala-3/zio/nio/channels/package.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package zio.nio | ||
|
||
import zio.stream.ZStream | ||
import zio.{Scope, ZIO, Trace} | ||
|
||
/** | ||
* A mutable buffer of shorts. | ||
*/ | ||
object ZStreamHelper { | ||
|
||
/** | ||
* Creates a stream from a Java stream | ||
*/ | ||
final def fromJavaStream[A](stream: => java.util.stream.Stream[A])(implicit | ||
trace: Trace | ||
): ZStream[Any, Throwable, A] = | ||
fromJavaStream(stream, ZStream.DefaultChunkSize) | ||
|
||
/** | ||
* Creates a stream from a Java stream | ||
*/ | ||
final def fromJavaStream[A]( | ||
stream: => java.util.stream.Stream[A], | ||
chunkSize: Int | ||
)(implicit trace: Trace): ZStream[Any, Throwable, A] = | ||
ZStream.fromJavaIteratorScoped( | ||
ZIO.acquireRelease(ZIO.attempt(stream))(stream => ZIO.succeed(stream.close())).map(_.iterator()), | ||
chunkSize | ||
) | ||
|
||
/** | ||
* Creates a stream from a scoped Java stream | ||
*/ | ||
final def fromJavaStreamScoped[R, A](stream: => ZIO[Scope with R, Throwable, java.util.stream.Stream[A]])(implicit | ||
trace: Trace | ||
): ZStream[R, Throwable, A] = | ||
fromJavaStreamScoped[R, A](stream, ZStream.DefaultChunkSize) | ||
|
||
/** | ||
* Creates a stream from a scoped Java stream | ||
*/ | ||
final def fromJavaStreamScoped[R, A]( | ||
stream: => ZIO[Scope with R, Throwable, java.util.stream.Stream[A]], | ||
chunkSize: Int | ||
)(implicit trace: Trace): ZStream[R, Throwable, A] = | ||
ZStream.scoped[R](stream).flatMap(fromJavaStream(_, chunkSize)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...la/zio/nio/channels/DatagramChannel.scala → ...la/zio/nio/channels/DatagramChannel.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...rc/main/scala/zio/nio/channels/Pipe.scala → ...rc/main/scala/zio/nio/channels/Pipe.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...scala/zio/nio/channels/SelectionKey.scala → ...scala/zio/nio/channels/SelectionKey.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
...o/nio/channels/spi/SelectorProvider.scala → ...o/nio/channels/spi/SelectorProvider.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
nio/jvm/src/main/scala/zio/nio/file/FileSystemPlatformSpecific.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package zio.nio.file | ||
|
||
import zio.{Trace, ZIO, Scope} | ||
import java.io.IOException | ||
import java.nio.{file => jf} | ||
import zio.nio.IOCloseableManagement | ||
|
||
trait FileSystemPlatformSpecific { self => | ||
|
||
def jFileSystem: jf.FileSystem | ||
|
||
def newWatchService(implicit trace: Trace): ZIO[Scope, IOException, WatchService] = | ||
ZIO.attemptBlockingIO(WatchService.fromJava(jFileSystem.newWatchService())).toNioScoped | ||
} |
Oops, something went wrong.