Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardladenthin committed Mar 18, 2024
1 parent 3a48a03 commit b9bf1d0
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

public class PersistenceUtils {

@Deprecated
private final ByteBuffer emptyByteBuffer = ByteBuffer.allocateDirect(0).asReadOnlyBuffer();
private final ByteBuffer zeroByteBuffer = longValueToByteBufferDirectAsReadOnlyBuffer(0L);

Expand All @@ -49,6 +50,7 @@ public ByteBuffer longToByteBufferDirect(long longValue) {
return newValue;
}

@Deprecated
public ByteBuffer addressListToByteBufferDirect(List<LegacyAddress> addresses) {
ByteBuffer byteBuffer = ByteBuffer.allocateDirect(LegacyAddress.LENGTH * addresses.size());
for (LegacyAddress address : addresses) {
Expand All @@ -58,6 +60,7 @@ public ByteBuffer addressListToByteBufferDirect(List<LegacyAddress> addresses) {
return byteBuffer;
}

@Deprecated
public List<LegacyAddress> byteBufferToAddressList(ByteBuffer byteBuffer) {
List<LegacyAddress> addresses = new ArrayList<>();
int count = byteBuffer.remaining() / LegacyAddress.LENGTH;
Expand All @@ -69,10 +72,12 @@ public List<LegacyAddress> byteBufferToAddressList(ByteBuffer byteBuffer) {
return addresses;
}

@Deprecated
public ByteBuffer hashToByteBufferDirect(Sha256Hash hash) {
return new ByteBufferUtility(true).byteArrayToByteBuffer(hash.getBytes());
}

@Deprecated
public ByteBuffer longValueToByteBufferDirectAsReadOnlyBuffer(long value) {
ByteBuffer byteBuffer = ByteBuffer.allocateDirect(Long.BYTES);
byteBuffer.putLong(value);
Expand Down

0 comments on commit b9bf1d0

Please sign in to comment.