Class CharBufImage
java.lang.Object
io.nosqlbench.virtdata.library.basics.shared.from_long.to_string.CharBufImage
- All Implemented Interfaces:
LongFunction<CharBuffer>
Builds a shared text image in memory and samples from it
pseudo-randomly with hashing.
The characters provided can be listed like a string (abc123),
or can include range specifiers like a hyphen (a-zA-Z0-9).
These characters are used to build an image of the specified size in
memory that is sampled from according to the size function.
The extracted value is sized according to either a provided function, a
size range, or otherwise the whole image.
The image can be varied between tests if you want by specifying a seed
value. If no seed value is specified, then the image length is used
also as a seed.
-
Constructor Summary
ConstructorsConstructorDescriptionCharBufImage(int size) Shortcut constructor for building a simple text image from A-Z, a-z, 0-9 and a space, of the specified size.CharBufImage(Object charsFunc, int imgsize) This is the same asCharBufImage(java.lang.Object,int,java.lang.Object)except that the extracted sample length is fixed to the buffer size, thus the function will always return the full buffer.CharBufImage(Object charsFunc, int imgsize, Object sizespec) This is the same asCharBufImage(java.lang.Object,int,java.lang.Object,long)excep that the seed is defaulted to 0LCharBufImage(Object charsFunc, int imgsize, Object sizespec, long seed) Create a CharBuffer full of the contents of the results of calling a source function until it is full. -
Method Summary
-
Constructor Details
-
CharBufImage
public CharBufImage(int size) Shortcut constructor for building a simple text image from A-Z, a-z, 0-9 and a space, of the specified size. When this function is used, it always returns the full image if constructed in this way.- Parameters:
size- length in characters of the image.
-
CharBufImage
This is the same asCharBufImage(java.lang.Object,int,java.lang.Object)except that the extracted sample length is fixed to the buffer size, thus the function will always return the full buffer.- Parameters:
charsFunc- The function which produces objects, which toString() is used to collect their inputimgsize- The size of the CharBuffer to build at startup
-
CharBufImage
This is the same asCharBufImage(java.lang.Object,int,java.lang.Object,long)excep that the seed is defaulted to 0L- Parameters:
charsFunc- The function which produces objects, which toString() is used to collect their inputimgsize- The size of the CharBuffer to build at startupsizespec- The specifier for how long samples should be. If this is a number, then it is static. If it is a function, then the size is determined for each call.
-
CharBufImage
Create a CharBuffer full of the contents of the results of calling a source function until it is full. Then allow it to be sampled with random extracts as determined by the sizespec.- Parameters:
charsFunc- The function which produces objects, which toString() is used to collect their inputimgsize- The size of the CharBuffer to build at startupsizespec- The specifier for how long samples should be. If this is a number, then it is static. If it is a function, then the size is determined for each call.seed- A seed that can be used to change up the rendered content.
-
-
Method Details
-
apply
- Specified by:
applyin interfaceLongFunction<CharBuffer>
-