@Override public BSONCallback createBSONCallback() { return new BasicBSONCallback(); }
@Override public BSONObject readObject(final byte[] bytes) { BSONCallback bsonCallback = new BasicBSONCallback(); decode(bytes, bsonCallback); return (BSONObject) bsonCallback.get(); }
public BSONCallback createBSONCallback() { return new BasicBSONCallback(); }
public BSONObject readObject( InputStream in ) throws IOException { BasicBSONCallback c = new BasicBSONCallback(); decode( in , c ); return (BSONObject)c.get(); }
public BSONObject readObject(final byte [] pData) { _length = pData.length; final BasicBSONCallback c = new BasicBSONCallback(); _decode(pData, 0, c); return (BSONObject)c.get(); }
/** * {@inheritDoc} * * @see Writable#readFields(DataInput) */ public void readFields( DataInput in ) throws IOException{ BSONDecoder dec = new BasicBSONDecoder(); BSONCallback cb = new BasicBSONCallback(); // Read the BSON length from the start of the record byte[] l = new byte[4]; try { in.readFully( l ); int dataLen = Bits.readInt( l ); if ( log.isDebugEnabled() ) log.debug( "*** Expected DataLen: " + dataLen ); byte[] data = new byte[dataLen + 4]; System.arraycopy( l, 0, data, 0, 4 ); in.readFully( data, 4, dataLen - 4 ); dec.decode( data, cb ); _doc = (BSONObject) cb.get(); if ( log.isTraceEnabled() ) log.trace( "Decoded a BSON Object: " + _doc ); } catch ( Exception e ) { /* If we can't read another length it's not an error, just return quietly. */ // TODO - Figure out how to gracefully mark this as an empty log.info( "No Length Header available." + e ); _doc = new BasicDBObject(); } }
/** * {@inheritDoc} * * @see Writable#readFields(DataInput) */ public void readFields( DataInput in ) throws IOException{ BSONDecoder dec = new BasicBSONDecoder(); BSONCallback cb = new BasicBSONCallback(); // Read the BSON length from the start of the record byte[] l = new byte[4]; try { in.readFully( l ); int dataLen = Bits.readInt( l ); if ( log.isDebugEnabled() ) log.debug( "*** Expected DataLen: " + dataLen ); byte[] data = new byte[dataLen + 4]; System.arraycopy( l, 0, data, 0, 4 ); in.readFully( data, 4, dataLen - 4 ); dec.decode( data, cb ); _doc = (BSONObject) cb.get(); if ( log.isTraceEnabled() ) log.trace( "Decoded a BSON Object: " + _doc ); } catch ( Exception e ) { /* If we can't read another length it's not an error, just return quietly. */ // TODO - Figure out how to gracefully mark this as an empty log.info( "No Length Header available." + e ); _doc = new BasicDBObject(); } }
/** * {@inheritDoc} * * @see Writable#readFields(DataInput) */ public void readFields( DataInput in ) throws IOException{ BSONDecoder dec = new BasicBSONDecoder(); BSONCallback cb = new BasicBSONCallback(); // Read the BSON length from the start of the record byte[] l = new byte[4]; try { in.readFully( l ); int dataLen = Bits.readInt( l ); if ( log.isDebugEnabled() ) log.debug( "*** Expected DataLen: " + dataLen ); byte[] data = new byte[dataLen + 4]; System.arraycopy( l, 0, data, 0, 4 ); in.readFully( data, 4, dataLen - 4 ); dec.decode( data, cb ); _doc = (BSONObject) cb.get(); if ( log.isTraceEnabled() ) log.trace( "Decoded a BSON Object: " + _doc ); } catch ( Exception e ) { /* If we can't read another length it's not an error, just return quietly. */ // TODO - Figure out how to gracefully mark this as an empty log.info( "No Length Header available." + e ); _doc = new BasicDBObject(); } }
/** * {@inheritDoc} * * @see Writable#readFields(DataInput) */ public void readFields( DataInput in ) throws IOException{ BSONDecoder dec = new BasicBSONDecoder(); BSONCallback cb = new BasicBSONCallback(); // Read the BSON length from the start of the record byte[] l = new byte[4]; try { in.readFully( l ); int dataLen = Bits.readInt( l ); if ( log.isDebugEnabled() ) log.debug( "*** Expected DataLen: " + dataLen ); byte[] data = new byte[dataLen + 4]; System.arraycopy( l, 0, data, 0, 4 ); in.readFully( data, 4, dataLen - 4 ); dec.decode( data, cb ); _doc = (BSONObject) cb.get(); if ( log.isTraceEnabled() ) log.trace( "Decoded a BSON Object: " + _doc ); } catch ( Exception e ) { /* If we can't read another length it's not an error, just return quietly. */ // TODO - Figure out how to gracefully mark this as an empty log.info( "No Length Header available." + e ); _doc = new BasicDBObject(); } }
/** * {@inheritDoc} * * @see Writable#readFields(DataInput) */ public void readFields( DataInput in ) throws IOException{ BSONDecoder dec = new BasicBSONDecoder(); BSONCallback cb = new BasicBSONCallback(); // Read the BSON length from the start of the record byte[] l = new byte[4]; try { in.readFully( l ); int dataLen = Bits.readInt( l ); if ( log.isDebugEnabled() ) log.debug( "*** Expected DataLen: " + dataLen ); byte[] data = new byte[dataLen + 4]; System.arraycopy( l, 0, data, 0, 4 ); in.readFully( data, 4, dataLen - 4 ); dec.decode( data, cb ); _doc = (BSONObject) cb.get(); if ( log.isTraceEnabled() ) log.trace( "Decoded a BSON Object: " + _doc ); } catch ( Exception e ) { /* If we can't read another length it's not an error, just return quietly. */ // TODO - Figure out how to gracefully mark this as an empty log.info( "No Length Header available." + e ); _doc = new BasicDBObject(); } }
BSONCallback cb = new BasicBSONCallback();
BSONCallback cb = new BasicBSONCallback();
BSONCallback cb = new BasicBSONCallback();
@Override public void initialize(final InputSplit inputSplit, final TaskAttemptContext context) throws IOException, InterruptedException { fileSplit = (FileSplit) inputSplit; final Configuration configuration = context.getConfiguration(); if (LOG.isDebugEnabled()) { LOG.debug("reading split " + fileSplit); } Path file = fileSplit.getPath(); FileSystem fs = file.getFileSystem(configuration); in = fs.open(file, 16 * 1024 * 1024); in.seek(fileSplit.getStart()); if (MongoConfigUtil.getLazyBSON(configuration)) { callback = new LazyBSONCallback(); decoder = new LazyBSONDecoder(); } else { callback = new BasicBSONCallback(); decoder = new BasicBSONDecoder(); } }
@Override public BSONObject readObject(byte[] b, int offset) { _length = Bits.readInt(b, offset); final BasicBSONCallback c = new BasicBSONCallback(); _decode(b, offset, c); return (BSONObject)c.get(); }
public void initialize(final InputSplit inputSplit, final Configuration conf) throws IOException { fileSplit = (FileSplit) inputSplit; Path file = fileSplit.getPath(); FileSystem fs = file.getFileSystem(conf); in = fs.open(file, 16 * 1024 * 1024); in.seek(fileSplit.getStart()); if (MongoConfigUtil.getLazyBSON(conf)) { callback = new LazyBSONCallback(); decoder = new LazyBSONDecoder(); } else { callback = new BasicBSONCallback(); decoder = new BasicBSONDecoder(); } }
public void readFields( DataInput in ) throws IOException{ BSONDecoder dec = getBSONDecoder(); BSONCallback cb = new BasicBSONCallback(); BSONObject spec;
public void init(final InputSplit inputSplit, final Configuration configuration) throws IOException, InterruptedException { this.configuration = configuration; fileSplit = (FileSplit) inputSplit; if (LOG.isDebugEnabled()) { LOG.debug("reading split " + fileSplit); } Path file = fileSplit.getPath(); FileSystem fs = file.getFileSystem(configuration); CompressionCodec codec = new CompressionCodecFactory(configuration) .getCodec(fileSplit.getPath()); inRaw = fs.open(file, 16 * 1024 * 1024); inRaw.seek( startingPosition == BSON_RR_POSITION_NOT_GIVEN ? fileSplit.getStart() : startingPosition); if (codec != null) { decompressor = CodecPool.getDecompressor(codec); in = codec.createInputStream(inRaw, decompressor); } else { in = inRaw; } if (MongoConfigUtil.getLazyBSON(configuration)) { callback = new LazyBSONCallback(); decoder = new LazyBSONDecoder(); } else { callback = new BasicBSONCallback(); decoder = new BasicBSONDecoder(); } }
@Override public void readFields(final DataInput in) throws IOException { BSONCallback cb = new BasicBSONCallback(); BSONObject spec; byte[] l = new byte[4];
@Override public void readFields(final DataInput in) throws IOException { BSONCallback cb = new BasicBSONCallback(); BSONObject spec; byte[] l = new byte[4];