Java-Direct icon indicating copy to clipboard operation
Java-Direct copied to clipboard

Some proposals

Open RuedigerMoeller opened this issue 11 years ago • 0 comments

I have built (like many others) a similar byte mem infrastructure at https://github.com/RuedigerMoeller/fast-serialization/tree/master/src/main/java/org/nustaq/offheap/bytez).

Some remarks Bytes class: I'd miss "put( Bytes b, int off, int len)"

Additionally, at application level i frequently had the need to map some other datastructure to act as a byte (examples: https://github.com/RuedigerMoeller/fast-serialization/tree/master/src/main/java/org/nustaq/offheap/bytez/bytesource)

as the Bytes interface is huge, by the time i required weaker forms of the interface, namely

  • ByteSource - readonly interface (see https://github.com/RuedigerMoeller/fast-serialization/blob/master/src/main/java/org/nustaq/offheap/bytez/ByteSource.java)
  • BasicBytez - a weaker rw interface (see https://github.com/RuedigerMoeller/fast-serialization/blob/master/src/main/java/org/nustaq/offheap/bytez/BasicBytez.java)

I also have a "newInstance(long)" method on the Bytez class which creates a new Bytes instance of same underlying type (questionable, but avoids to pass along a factory/allocator instance all around the code).

RuedigerMoeller avatar Dec 23 '14 15:12 RuedigerMoeller