Animation below shows what is happening when you use IDataInput interface methods to access data form ByteArray and other classes which implement this interface.