/** Fills up the rawKey object with the key returned by the Reader * @return true if there is a key returned; false, otherwise * @throws IOException */ public boolean nextRawKey() throws IOException { if (in == null) { int bufferSize = getBufferSize(conf); Reader reader = new Reader(conf, Reader.file(segmentPathName), Reader.bufferSize(bufferSize), Reader.start(segmentOffset), Reader.length(segmentLength)); //sometimes we ignore syncs especially for temp merge files if (ignoreSync) reader.ignoreSync(); if (reader.getKeyClass() != keyClass) throw new IOException("wrong key class: " + reader.getKeyClass() + " is not " + keyClass); if (reader.getValueClass() != valClass) throw new IOException("wrong value class: "+reader.getValueClass()+ " is not " + valClass); this.in = reader; rawKey = new DataOutputBuffer(); } rawKey.reset(); int keyLength = in.nextRawKey(rawKey); return (keyLength >= 0); }
/** Fills up the rawKey object with the key returned by the Reader * @return true if there is a key returned; false, otherwise * @throws IOException */ public boolean nextRawKey() throws IOException { if (in == null) { int bufferSize = conf.getInt("io.file.buffer.size", 4096); if (fs.getUri().getScheme().startsWith("ramfs")) { bufferSize = conf.getInt("io.bytes.per.checksum", 512); } Reader reader = new Reader(fs, segmentPathName, bufferSize, segmentOffset, segmentLength, conf, false); //sometimes we ignore syncs especially for temp merge files if (ignoreSync) reader.sync = null; if (reader.getKeyClass() != keyClass) throw new IOException("wrong key class: " + reader.getKeyClass() + " is not " + keyClass); if (reader.getValueClass() != valClass) throw new IOException("wrong value class: "+reader.getValueClass()+ " is not " + valClass); this.in = reader; rawKey = new DataOutputBuffer(); } rawKey.reset(); int keyLength = in.nextRawKey(rawKey); return (keyLength >= 0); }
/** * Read raw bytes from a SequenceFile. */ public synchronized boolean nextKeyValue() throws IOException, InterruptedException { if (done) { return false; } long pos = in.getPosition(); boolean eof = -1 == in.nextRawKey(buffer); if (!eof) { if (key == null) { key = new BytesWritable(); } if (value == null) { value = new BytesWritable(); } key.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); in.nextRawValue(vbytes); vbytes.writeUncompressedBytes(buffer); value.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); } return !(done = (eof || (pos >= end && in.syncSeen()))); }
/** * Read raw bytes from a SequenceFile. */ public synchronized boolean nextKeyValue() throws IOException, InterruptedException { if (done) { return false; } long pos = in.getPosition(); boolean eof = -1 == in.nextRawKey(buffer); if (!eof) { if (key == null) { key = new BytesWritable(); } if (value == null) { value = new BytesWritable(); } key.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); in.nextRawValue(vbytes); vbytes.writeUncompressedBytes(buffer); value.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); } return !(done = (eof || (pos >= end && in.syncSeen()))); }
/** * Read raw bytes from a SequenceFile. */ public synchronized boolean nextKeyValue() throws IOException, InterruptedException { if (done) { return false; } long pos = in.getPosition(); boolean eof = -1 == in.nextRawKey(buffer); if (!eof) { if (key == null) { key = new BytesWritable(); } if (value == null) { value = new BytesWritable(); } key.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); in.nextRawValue(vbytes); vbytes.writeUncompressedBytes(buffer); value.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); } return !(done = (eof || (pos >= end && in.syncSeen()))); }
/** * Read raw bytes from a SequenceFile. */ public synchronized boolean nextKeyValue() throws IOException, InterruptedException { if (done) { return false; } long pos = in.getPosition(); boolean eof = -1 == in.nextRawKey(buffer); if (!eof) { if (key == null) { key = new BytesWritable(); } if (value == null) { value = new BytesWritable(); } key.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); in.nextRawValue(vbytes); vbytes.writeUncompressedBytes(buffer); value.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); } return !(done = (eof || (pos >= end && in.syncSeen()))); }
/** Fills up the rawKey object with the key returned by the Reader * @return true if there is a key returned; false, otherwise * @throws IOException */ public boolean nextRawKey() throws IOException { if (in == null) { int bufferSize = getBufferSize(conf); Reader reader = new Reader(conf, Reader.file(segmentPathName), Reader.bufferSize(bufferSize), Reader.start(segmentOffset), Reader.length(segmentLength)); //sometimes we ignore syncs especially for temp merge files if (ignoreSync) reader.ignoreSync(); if (reader.getKeyClass() != keyClass) throw new IOException("wrong key class: " + reader.getKeyClass() + " is not " + keyClass); if (reader.getValueClass() != valClass) throw new IOException("wrong value class: "+reader.getValueClass()+ " is not " + valClass); this.in = reader; rawKey = new DataOutputBuffer(); } rawKey.reset(); int keyLength = in.nextRawKey(rawKey); return (keyLength >= 0); }
/** Fills up the rawKey object with the key returned by the Reader * @return true if there is a key returned; false, otherwise * @throws IOException */ public boolean nextRawKey() throws IOException { if (in == null) { int bufferSize = getBufferSize(conf); Reader reader = new Reader(conf, Reader.file(segmentPathName), Reader.bufferSize(bufferSize), Reader.start(segmentOffset), Reader.length(segmentLength)); //sometimes we ignore syncs especially for temp merge files if (ignoreSync) reader.ignoreSync(); if (reader.getKeyClass() != keyClass) throw new IOException("wrong key class: " + reader.getKeyClass() + " is not " + keyClass); if (reader.getValueClass() != valClass) throw new IOException("wrong value class: "+reader.getValueClass()+ " is not " + valClass); this.in = reader; rawKey = new DataOutputBuffer(); } rawKey.reset(); int keyLength = in.nextRawKey(rawKey); return (keyLength >= 0); }
/** Fills up the rawKey object with the key returned by the Reader * @return true if there is a key returned; false, otherwise * @throws IOException */ public boolean nextRawKey() throws IOException { if (in == null) { int bufferSize = getBufferSize(conf); Reader reader = new Reader(conf, Reader.file(segmentPathName), Reader.bufferSize(bufferSize), Reader.start(segmentOffset), Reader.length(segmentLength)); //sometimes we ignore syncs especially for temp merge files if (ignoreSync) reader.ignoreSync(); if (reader.getKeyClass() != keyClass) throw new IOException("wrong key class: " + reader.getKeyClass() + " is not " + keyClass); if (reader.getValueClass() != valClass) throw new IOException("wrong value class: "+reader.getValueClass()+ " is not " + valClass); this.in = reader; rawKey = new DataOutputBuffer(); } rawKey.reset(); int keyLength = in.nextRawKey(rawKey); return (keyLength >= 0); }
/** * Read raw bytes from a SequenceFile. */ public synchronized boolean nextKeyValue() throws IOException, InterruptedException { if (done) { return false; } long pos = in.getPosition(); boolean eof = -1 == in.nextRawKey(buffer); if (!eof) { if (key == null) { key = new BytesWritable(); } if (value == null) { value = new BytesWritable(); } key.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); in.nextRawValue(vbytes); vbytes.writeUncompressedBytes(buffer); value.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); } return !(done = (eof || (pos >= end && in.syncSeen()))); }
/** Fills up the rawKey object with the key returned by the Reader * @return true if there is a key returned; false, otherwise * @throws IOException */ public boolean nextRawKey() throws IOException { if (in == null) { int bufferSize = getBufferSize(conf); Reader reader = new Reader(conf, Reader.file(segmentPathName), Reader.bufferSize(bufferSize), Reader.start(segmentOffset), Reader.length(segmentLength)); //sometimes we ignore syncs especially for temp merge files if (ignoreSync) reader.ignoreSync(); if (reader.getKeyClass() != keyClass) throw new IOException("wrong key class: " + reader.getKeyClass() + " is not " + keyClass); if (reader.getValueClass() != valClass) throw new IOException("wrong value class: "+reader.getValueClass()+ " is not " + valClass); this.in = reader; rawKey = new DataOutputBuffer(); } rawKey.reset(); int keyLength = in.nextRawKey(rawKey); return (keyLength >= 0); }
/** * Read raw bytes from a SequenceFile. */ public synchronized boolean next(BytesWritable key, BytesWritable val) throws IOException { if (done) return false; long pos = in.getPosition(); boolean eof = -1 == in.nextRawKey(buffer); if (!eof) { key.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); in.nextRawValue(vbytes); vbytes.writeUncompressedBytes(buffer); val.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); } return !(done = (eof || (pos >= end && in.syncSeen()))); }
/** * Read raw bytes from a SequenceFile. */ public synchronized boolean next(BytesWritable key, BytesWritable val) throws IOException { if (done) return false; long pos = in.getPosition(); boolean eof = -1 == in.nextRawKey(buffer); if (!eof) { key.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); in.nextRawValue(vbytes); vbytes.writeUncompressedBytes(buffer); val.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); } return !(done = (eof || (pos >= end && in.syncSeen()))); }
/** * Read raw bytes from a SequenceFile. */ public synchronized boolean next(BytesWritable key, BytesWritable val) throws IOException { if (done) return false; long pos = in.getPosition(); boolean eof = -1 == in.nextRawKey(buffer); if (!eof) { key.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); in.nextRawValue(vbytes); vbytes.writeUncompressedBytes(buffer); val.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); } return !(done = (eof || (pos >= end && in.syncSeen()))); }
/** * Read raw bytes from a SequenceFile. */ public synchronized boolean next(BytesWritable key, BytesWritable val) throws IOException { if (done) return false; long pos = in.getPosition(); boolean eof = -1 == in.nextRawKey(buffer); if (!eof) { key.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); in.nextRawValue(vbytes); vbytes.writeUncompressedBytes(buffer); val.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); } return !(done = (eof || (pos >= end && in.syncSeen()))); }
/** * Read raw bytes from a SequenceFile. */ public synchronized boolean next(BytesWritable key, BytesWritable val) throws IOException { if (done) return false; long pos = in.getPosition(); boolean eof = -1 == in.nextRawKey(buffer); if (!eof) { key.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); in.nextRawValue(vbytes); vbytes.writeUncompressedBytes(buffer); val.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); } return !(done = (eof || (pos >= end && in.syncSeen()))); }
/** * Read raw bytes from a SequenceFile. */ public synchronized boolean next(BytesWritable key, BytesWritable val) throws IOException { if (done) return false; long pos = in.getPosition(); boolean eof = -1 == in.nextRawKey(buffer); if (!eof) { key.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); in.nextRawValue(vbytes); vbytes.writeUncompressedBytes(buffer); val.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); } return !(done = (eof || (pos >= end && in.syncSeen()))); }
/** * Read the next {@link ITuple} in the file into <code>tuple</code>. * True if another entry exists, and false at end of file. */ public synchronized boolean next(ITuple tuple) throws IOException { outBuffer.reset(); int i = innerReader.nextRawKey(outBuffer); if (i < 0) { return false; } inBuffer.reset(outBuffer.getData(), outBuffer.getLength()); deser.deserialize(tuple); return true; }
/** * Read raw bytes from a SequenceFile. */ public synchronized boolean next(BytesWritable key, BytesWritable val) throws IOException { if (done) return false; long pos = in.getPosition(); boolean eof = -1 == in.nextRawKey(buffer); if (!eof) { key.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); in.nextRawValue(vbytes); vbytes.writeUncompressedBytes(buffer); val.set(buffer.getData(), 0, buffer.getLength()); buffer.reset(); } return !(done = (eof || (pos >= end && in.syncSeen()))); }
/** * Read the next {@link ITuple} in the file into <code>tuple</code>. * True if another entry exists, and false at end of file. */ public synchronized boolean next(ITuple tuple) throws IOException { outBuffer.reset(); int i = innerReader.nextRawKey(outBuffer); if (i < 0) { return false; } inBuffer.reset(outBuffer.getData(), outBuffer.getLength()); deser.deserialize(tuple); return true; }