dweiss commented on pull request #2094: URL: https://github.com/apache/lucene-solr/pull/2094#issuecomment-734754136
I created a PR which kind of shows what I had in mind, it's here (won't compile, it's a PoC only to convey the idea). https://github.com/apache/lucene-solr/pull/2100 The byte-order data type reader is acquired from DataInput (and subclasses) with a method that takes byte order as an argument. https://github.com/apache/lucene-solr/pull/2100/files#diff-f07fa6b85566fe26f4da99bae2f7b7ab416899c7de849ec924a8ac2e51e046a0R126 This default method returns the byte-order-sensitive "typed" reader that implements delegates proper endianness and delegates to the source DataInput class. Subclasses can either reimplementing it fully if they can optimize byte-order access (as shown in ByteArrayDataInput) or can implement just one selected endianness (and the other one is provided via the wrapper). The same idea could be pulled up so that DataInput itself contains the byte-order, without any separate interface (TypedReader) but I think it's actually beneficial not to do so. In fact, a separate "typed reader" view makes it more elegant to delegate low-level methods to actual data source rather than overriding multiple methods from the superclass. This does seem like a lengthy effort but I wanted to show this to you for consideration. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org