io.nosqlbench.virtdata.userlibs.streams.ByteBufferStreams Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of driver-cql-shaded Show documentation
Show all versions of driver-cql-shaded Show documentation
A Shaded CQL ActivityType driver for http://nosqlbench.io/
package io.nosqlbench.virtdata.userlibs.streams;
import io.nosqlbench.virtdata.library.basics.shared.from_long.to_bytebuffer.HashedToByteBuffer;
import io.nosqlbench.virtdata.userlibs.streams.fillers.ChunkedByteBuffer;
import io.nosqlbench.virtdata.userlibs.streams.fillers.LongFunctionIterable;
import io.nosqlbench.virtdata.userlibs.streams.pojos.ByteBufferObject;
import org.jetbrains.annotations.NotNull;
import java.nio.ByteBuffer;
import java.util.Iterator;
public class ByteBufferStreams {
public static Iterable byteBufferObjects(long startCycle, long endCycle, int bufsize) {
HashedToByteBuffer htbb = new HashedToByteBuffer(bufsize);
LongFunctionIterable bbi = new LongFunctionIterable<>(startCycle, endCycle, l -> new ByteBufferObject(htbb.apply(l)));
return bbi;
// LongFunctionIterable byteBuffers = new LongFunctionIterable<>(0L, new HashedToByteBuffer(bufsize));
}
public static Iterable byteBuffers(long startCycle, long endCycle, int bufsize) {
HashedToByteBuffer htbb = new HashedToByteBuffer(bufsize);
LongFunctionIterable bbi = new LongFunctionIterable<>(startCycle, endCycle, htbb);
return bbi;
}
public static Iterable partialByteBuffers(int startCycle, int endCycle, int bufSize) {
Iterable byteBuffers = byteBuffers(startCycle, endCycle, bufSize);
return new ChunkedByteBuffer(byteBuffers);
}
private final static class ByteBufferObjectIterable implements Iterable {
@NotNull
@Override
public Iterator iterator() {
return new ByteBufferObjectIterator();
}
private final static class ByteBufferObjectIterator implements Iterator {
@Override
public boolean hasNext() {
return false;
}
@Override
public ByteBufferObject next() {
return null;
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy