Here's code that reproduces it.

public void testMain() throws IOException {
    RAMDirectory ramDirectory = new RAMDirectory();
    IndexOutput output = ramDirectory.createOutput("test");
    byte[] bytes = "hello world".getBytes("UTF-8");
    output.writeBytes(bytes, bytes.length);
    output.flush();
    System.out.println("fileLength: "+ramDirectory.fileLength("test"));
    output = ramDirectory.createOutput("test");
    IndexInput input = ramDirectory.openInput("test");
    System.out.println("input length: "+input.length());
  }

On Thu, Jun 19, 2008 at 2:59 PM, Jason Rutherglen <
[EMAIL PROTECTED]> wrote:

> Yes.  Also close.  But then reopen the IndexOutput again later, then open
> the IndexInput.  I'm not sure if this is the recomended usage of these
> APIs.  It seems everywhere else in the Lucene code base only one is open at
> a time.
>
>
> On Thu, Jun 19, 2008 at 12:50 PM, Yonik Seeley <[EMAIL PROTECTED]> wrote:
>
>> Did you try calling flush() on the IndexOutput before opening the
>> IndexInput?
>>
>> -Yonik
>>
>> On Thu, Jun 19, 2008 at 12:13 PM, Jason Rutherglen
>> <[EMAIL PROTECTED]> wrote:
>> > Seeing strange behavior with RAMDirectory.  Is a file designed to
>> supported
>> > IndexOutput being open concurrently with IndexInput?  I open an
>> IndexInput
>> > with IndexOutput open, with data written to the file previously, and the
>> > IndexInput is reporting a filelength of 0, while Directory.fileLength()
>> > reports 110.  Also seeing other strange behavior.
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>

Reply via email to