Skip to content

Commit

Permalink
Fix the build
Browse files Browse the repository at this point in the history
  • Loading branch information
TheElectronWill committed Nov 26, 2017
1 parent ea97848 commit d3792b6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/main/scala/com/electronwill/niol/io/ChannelInput.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,22 @@ final class ChannelInput(private[this] val channel: ScatteringByteChannel,
bufferProvider: BufferProvider = BufferProvider.DefaultOffHeapProvider)
extends NiolInput with Closeable {

def this(fc: FileChannel, bufferProvider: BufferProvider = BufferProvider.DefaultOffHeapProvider) = {
def this(fc: FileChannel, bufferProvider: BufferProvider) = {
this(fc, Math.min(4096, fc.size.toInt), bufferProvider)
}

def this(path: Path, bufferProvider: BufferProvider = BufferProvider.DefaultOffHeapProvider) = {
def this(fc: FileChannel) = {
this(fc, BufferProvider.DefaultOffHeapProvider)
}

def this(path: Path, bufferProvider: BufferProvider) = {
this(FileChannel.open(path, StandardOpenOption.READ), bufferProvider)
}

def this(path: Path) = {
this(path, BufferProvider.DefaultOffHeapProvider)
}

private[this] val buffer: NiolBuffer = {
new CircularBuffer(bufferProvider.getBuffer(bufferCapacity))
}
Expand Down
10 changes: 9 additions & 1 deletion src/main/scala/com/electronwill/niol/io/ChannelOutput.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@ final class ChannelOutput(private[this] val channel: GatheringByteChannel,
bufferCapacity: Int = 4096,
directBuffer: Boolean = true) extends NiolOutput with Closeable {

def this(path: Path, bufferCapacity: Int = 4096, directBuffer: Boolean = true) = {
def this(path: Path, bufferCapacity: Int, directBuffer: Boolean) = {
this(FileChannel.open(path, StandardOpenOption.WRITE, StandardOpenOption.CREATE),
bufferCapacity, directBuffer)
}

def this(path: Path, bufferCapacity: Int) = {
this(path, bufferCapacity, true)
}

def this(path: Path) = {
this(path, 4096, true)
}

private[this] val buffer: ByteBuffer = {
if (directBuffer) {
ByteBuffer.allocateDirect(bufferCapacity)
Expand Down

0 comments on commit d3792b6

Please sign in to comment.