mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Added ChronicleMapBuilder.constantKey[Value]SizeBySample() methods
This commit is contained in:
@@ -47,5 +47,34 @@ public final class SizeMarshallers {
|
||||
}
|
||||
}
|
||||
|
||||
public static SizeMarshaller constant(long size) {
|
||||
return new ConstantSizeMarshaller(size);
|
||||
}
|
||||
|
||||
private static class ConstantSizeMarshaller implements SizeMarshaller {
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
private final long size;
|
||||
|
||||
private ConstantSizeMarshaller(long size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sizeEncodingSize(long size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSize(Bytes bytes, long size) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public long readSize(Bytes bytes) {
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
private SizeMarshallers() {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user