[ 
https://issues.apache.org/jira/browse/LUCENE-2126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12786959#action_12786959
 ] 

Marvin Humphrey commented on LUCENE-2126:
-----------------------------------------

FWIW, this approach is sort of the inverse of where we've gone with Lucy.  

In Lucy, low-level unbuffered IO operations are abstracted into FileHandle,
which is either a thin wrapper around a POSIX file descriptor (e.g.
FSFileHandle under unixen), or a simulation thereof (e.g. FSFileHandle under
Windows, RAMFileHandle).  

Then there are InStream and OutStream, which would be analogous to DataInput
and DataOutput, in that they have all the Lucy-specific encoding/decoding
methods.  However, instead of requiring that subclasses implement the
low-level IO operations, InStream "has a" FileHandle and OutStream "has a"
FileHandle.

The advantage of breaking out FileHandle as a separate class is that if e.g.
you extend InStream by adding on PFOR encoding, you automatically get the
benefit for all IO implementations.  I think that under the
DataInput/DataOutput model, that extension technique will only be available to
core devs of Lucene, no?

More info: 

  * LUCY-58 FileHandle
  * LUCY-63 InStream and OutStream

> Split up IndexInput and IndexOutput into DataInput and DataOutput
> -----------------------------------------------------------------
>
>                 Key: LUCENE-2126
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2126
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: Flex Branch
>            Reporter: Michael Busch
>            Assignee: Michael Busch
>            Priority: Minor
>             Fix For: Flex Branch
>
>         Attachments: lucene-2126.patch
>
>
> I'd like to introduce the two new classes DataInput and DataOutput
> that contain all methods from IndexInput and IndexOutput that actually
> decode or encode data, such as readByte()/writeByte(),
> readVInt()/writeVInt().
> Methods like getFilePointer(), seek(), close(), etc., which are not
> related to data encoding, but to files as input/output source stay in
> IndexInput/IndexOutput.
> This patch also changes ByteSliceReader/ByteSliceWriter to extend
> DataInput/DataOutput. Previously ByteSliceReader implemented the
> methods that stay in IndexInput by throwing RuntimeExceptions.
> See also LUCENE-2125.
> All tests pass.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to