Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala-幻影-将水滴保存到Cassandra_Scala_Cassandra_Blob_Phantom Dsl - Fatal编程技术网

Scala-幻影-将水滴保存到Cassandra

Scala-幻影-将水滴保存到Cassandra,scala,cassandra,blob,phantom-dsl,Scala,Cassandra,Blob,Phantom Dsl,我想给卡桑德拉保存一个文件 我将Scala与WebUDOS“%”phantom-dsl_2.10“%”1.4.0“驱动程序一起使用 我想我的模型是用 sealed class CassandraRepoBlob extends CassandraTable[CassandraRepoBlob, CassandraBlob] { object id extends UUIDColumn(this) with PrimaryKey[UUID] object blobby extends B

我想给卡桑德拉保存一个文件

我将Scala与WebUDOS“%”phantom-dsl_2.10“%”1.4.0“驱动程序一起使用

我想我的模型是用

sealed class CassandraRepoBlob extends CassandraTable[CassandraRepoBlob, CassandraBlob] {
  object id extends UUIDColumn(this) with PrimaryKey[UUID]

  object blobby extends BlobColumn(this)
这似乎预示着一类

case class CassandraBlob(
                        blobby: java.nio.ByteBuffer
我找不到太多的例子,所以只想看看我的思路是否正确


从这里开始,我想我需要把我的文件读给一个ByteBuffer,我应该可以走了吗

谢谢

“从这里开始,我想我需要把我的文件读成ByteBuffer,我应该可以走了吧?”是的,当我用java写一行,其中一列类型为blob的行是文件内容时,我必须将文件内容转换成ByteBuffer(实际上非常简单,ByteBuffer.wrap(java中的Files.readAllBytes(File.toPath()))