Open kevinhuangwl opened 10 months ago
Yeah, I tend to agree with you... if I recall correctly, the reasoning behind this was to match the API of the standard NIO buffer, where the get
method (so a "read" operation) writes to a destination buffer, while the put
method (write operation) reads from a source.
I think the confusion in NdArray is that it is not clear to which subject is attached the action read/write. How you describe it, the subject is the buffer itself, while in reality it is the caller who is taking the action to "read" or "write" to/from the buffer, the same way that it is the caller who makes the action to "get" or "put" a value.
Renaming them to readTo
and writeFrom
would make that clearer and would have less impact to existing users than simply switching their name.
Naturally when using DataBuffer.read(sth), should expect it to read from sth into the buffer, and vice versa.
But the API of DataBuffer is now just the opposite