Re: can't read the SequenceFile correctly

2009-02-09 Thread Raghu Angadi
+1 on something like getValidBytes(). Just the existence of this would warn many programmers about getBytes(). Raghu. Owen O'Malley wrote: On Feb 6, 2009, at 8:52 AM, Bhupesh Bansal wrote: Hey Tom, I got also burned by this ?? Why does BytesWritable.getBytes() returns non-vaild bytes ??

Re: can't read the SequenceFile correctly

2009-02-09 Thread Owen O'Malley
On Feb 6, 2009, at 8:52 AM, Bhupesh Bansal wrote: Hey Tom, I got also burned by this ?? Why does BytesWritable.getBytes() returns non-vaild bytes ?? Or we should add a BytesWritable.getValidBytes() kind of function. It does it because continually resizing the array to the "valid" length

RE: can't read the SequenceFile correctly

2009-02-06 Thread Bhupesh Bansal
-user@hadoop.apache.org Subject: Re: can't read the SequenceFile correctly Hi Mark, Not all the bytes stored in a BytesWritable object are necessarily valid. Use BytesWritable#getLength() to determine how much of the buffer returned by BytesWritable#getBytes() to use. Tom On Fri, Feb 6, 2009

Re: can't read the SequenceFile correctly

2009-02-06 Thread Mark Kerzner
Indeed, this was the answer! Thank you, Mark On Fri, Feb 6, 2009 at 4:25 AM, Tom White wrote: > Hi Mark, > > Not all the bytes stored in a BytesWritable object are necessarily > valid. Use BytesWritable#getLength() to determine how much of the > buffer returned by BytesWritable#getBytes() to us

Re: can't read the SequenceFile correctly

2009-02-06 Thread Tom White
Hi Mark, Not all the bytes stored in a BytesWritable object are necessarily valid. Use BytesWritable#getLength() to determine how much of the buffer returned by BytesWritable#getBytes() to use. Tom On Fri, Feb 6, 2009 at 5:41 AM, Mark Kerzner wrote: > Hi, > > I have written binary files to a Se

can't read the SequenceFile correctly

2009-02-05 Thread Mark Kerzner
Hi, I have written binary files to a SequenceFile, seemeingly successfully, but when I read them back with the code below, after a first few reads I get the same number of bytes for the different files. What could go wrong? Thank you, Mark reader = new SequenceFile.Reader(fs, path, con