Java View Buffers
In Java, you can create view buffers for putting primitive types into a buffer. To get a view buffer you use as<Type>Buffer(). When you write to a view buffer, you then have to go back and update the position of the original ByteBuffer.
Q1. What would be the reason an asByteBuffer() method is not implemented in the view buffers? This would not only be convenient, but less error prone to miscalculation by a programmer.
Q2. Is it bad OOD practice to put these kind of methods in child classes?
|