diff --git a/pom.xml b/pom.xml index c54bbed82..345c72ce4 100755 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ net.openhft chronicle-bom pom - 1.4.0 + 1.6.8-SNAPSHOT import diff --git a/src/main/java/net/openhft/chronicle/hash/impl/JavaLangBytesReusableBytesStore.java b/src/main/java/net/openhft/chronicle/hash/impl/JavaLangBytesReusableBytesStore.java index ebe6e625e..6af60c4e2 100644 --- a/src/main/java/net/openhft/chronicle/hash/impl/JavaLangBytesReusableBytesStore.java +++ b/src/main/java/net/openhft/chronicle/hash/impl/JavaLangBytesReusableBytesStore.java @@ -42,8 +42,8 @@ public class JavaLangBytesReusableBytesStore } @Override - public long address() throws UnsupportedOperationException { - return bytes.address(); + public long address(long offset) throws UnsupportedOperationException { + return bytes.address() + offset; } @Override diff --git a/src/main/java/net/openhft/chronicle/map/impl/stage/data/DummyValueZeroData.java b/src/main/java/net/openhft/chronicle/map/impl/stage/data/DummyValueZeroData.java index fd038f43e..0b74db8cc 100644 --- a/src/main/java/net/openhft/chronicle/map/impl/stage/data/DummyValueZeroData.java +++ b/src/main/java/net/openhft/chronicle/map/impl/stage/data/DummyValueZeroData.java @@ -17,7 +17,6 @@ package net.openhft.chronicle.map.impl.stage.data; import net.openhft.chronicle.bytes.RandomDataInput; -import net.openhft.chronicle.bytes.ZeroRandomDataInput; import net.openhft.chronicle.hash.AbstractData; import net.openhft.chronicle.map.impl.VanillaChronicleMapHolder; import net.openhft.sg.StageRef; diff --git a/src/main/java/net/openhft/chronicle/map/impl/stage/data/ZeroRandomDataInput.java b/src/main/java/net/openhft/chronicle/map/impl/stage/data/ZeroRandomDataInput.java new file mode 100644 index 000000000..20823d607 --- /dev/null +++ b/src/main/java/net/openhft/chronicle/map/impl/stage/data/ZeroRandomDataInput.java @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2015 higherfrequencytrading.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package net.openhft.chronicle.map.impl.stage.data; + +import net.openhft.chronicle.bytes.Bytes; +import net.openhft.chronicle.bytes.RandomDataInput; +import net.openhft.chronicle.core.OS; + +public enum ZeroRandomDataInput implements RandomDataInput { + INSTANCE; + + @Override + public byte readByte(long offset) { + return 0; + } + + @Override + public short readShort(long offset) { + return 0; + } + + @Override + public int readInt(long offset) { + return 0; + } + + @Override + public long readLong(long offset) { + return 0; + } + + @Override + public float readFloat(long offset) { + return 0; + } + + @Override + public double readDouble(long offset) { + return 0; + } + + @Override + public void nativeRead(long position, long address, long size) { + OS.memory().setMemory(address, size, (byte) 0); + } + + @Override + public long realCapacity() { + return Long.MAX_VALUE; + } + + @Override + public long capacity() { + return Long.MAX_VALUE; + } + + @Override + public long address(long offset) throws UnsupportedOperationException { + return offset; + } + + @Override + public Bytes bytesForRead() { + throw new UnsupportedOperationException(); + } + + @Override + public Bytes bytesForWrite() { + throw new UnsupportedOperationException(); + } + + @Override + public void reserve() throws IllegalStateException { + } + + @Override + public void release() throws IllegalStateException { + } + + @Override + public long refCount() { + return 0; + } +} \ No newline at end of file