
scales.utils.io.Buffers.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scales-xml_2.11 Show documentation
Show all versions of scales-xml_2.11 Show documentation
An alternate Scala Xml processing library
The newest version!
package scales.utils.io
import scales.utils.resources._
import java.nio.ByteBuffer
/**
* ByteBuffer.allocate(bufferSize) backed pool
*
* 8k default buffer size with a pool reduction of 30.
*/
class JVMBufferPool( val bufferSize : Int = 8192, override val reduceSize : Int = 30 ) extends SimpleUnboundedPool[ByteBuffer] {
def create =
ByteBuffer.allocate(bufferSize)
}
/**
* ByteBuffer.allocateDirect(bufferSize) backed pool
*
* 8k default buffer size with a pool reduction of 30
*/
class DirectBufferPool( val bufferSize : Int = 8192, override val reduceSize : Int = 30 ) extends SimpleUnboundedPool[ByteBuffer] {
def create =
ByteBuffer.allocateDirect(bufferSize)
}
/**
* Pools byte arrays
*/
class ByteArrayPool( val byteArraySize: Int ) extends SimpleUnboundedPool[Array[Byte]]{
def create =
Array.ofDim[Byte](byteArraySize)
}
/**
* Default buffer pool backed by byte arrays
*/
object DefaultBufferPool extends JVMBufferPool {
}
/**
* Default Byte Array pool with 8k chunks
*/
object DefaultByteArrayPool extends ByteArrayPool(8192) {
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy