Why not add IndexInput/Output methods to read/write to/from Input/OutputStream, ByteBuffer and/or byte[]? Isn't their logic general enough to make them utility classes?
On Dec 14, 2007 9:55 AM, Doron Cohen <[EMAIL PROTECTED]> wrote: > On Dec 13, 2007 6:55 PM, Grant Ingersoll <[EMAIL PROTECTED]> wrote: > > > Yes. > > > > On Dec 13, 2007, at 10:43 AM, Doron Cohen wrote: > > > > > Did you mean refactoring IndexInput.readVint() and > > > IndeOutput.writeVint() > > > so that they can be used for e.g. payloads? > > > Huh, sorry for the stupid question, it was in the subject all along. > > > > > > > > On Dec 13, 2007 4:50 PM, Grant Ingersoll < [EMAIL PROTECTED]> wrote: > > > > > >> I have been fiddling w/ some payload token filter helpers, such as > > >> the > > >> NumericPayloadTokenFilter. I was in the process of adding a > > >> TokenOffsetPayloadTokenFilter (what a mouthful) that adds the start > > >> and end offset as payloads to the token. Now, the easiest way to do > > >> this is to encode the first 4 bytes with the startOffset and > > >> another 4 > > >> bytes as the endOffset. Then it occurs to me that it might make > > >> sense > > >> to encode them as vInts to save some bits. Naturally, there is no > > >> point in duplicating code, so I wonder if it makes sense to make > > >> these > > >> available for people wanting to encode payloads. Any thoughts on > > >> this? > > > Seems good to me, as long as IndexIn/Output efficiency and > readability is not hurt. Do you already have an API in mind? > > > > >> > > >> -Grant > > > -- Regards, Shai Erera
