scray.hdfs.io.index.format.example.ReadExampleSequenceFile.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scray-hdfs-writer Show documentation
Show all versions of scray-hdfs-writer Show documentation
scray adapter to write BLOBs to HDFS
package scray.hdfs.io.index.format.example
import scray.hdfs.io.index.format.sequence.SequenceFileWriter
import scray.hdfs.io.index.format.sequence.IdxReader
import scray.hdfs.io.index.format.sequence.ValueFileReader
import scray.hdfs.io.index.format.sequence.mapping.impl.OutputBlob
object ReadExampleSequenceFile {
def main(args: Array[String]) {
if (args.size == 0) {
println("No HDFS URL defined. E.g. hdfs://127.0.0.1/user/scray/scray-hdfs-data/")
} else {
val idxReader = new IdxReader(s"${args(0)}.idx", new OutputBlob)
val blobReader = new ValueFileReader(s"${args(0)}.blob", new OutputBlob)
while(idxReader.hasNext) {
val idx = idxReader.next().get
println("idx" + idx)
println("Data: \t" + new String(blobReader.getNextBlob(idx.getKey, 0, idx.getPosition).get._2.getData))
println("\n")
}
idxReader.close
blobReader.close
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy