private IndexCommandHeader readIndexCommandHeader( ReadableChannel channel ) throws IOException { byte firstHeaderByte = channel.get(); byte valueType = (byte) ((firstHeaderByte & 0x1C) >> 2); byte entityType = (byte) ((firstHeaderByte & 0x2) >> 1); boolean entityIdNeedsLong = (firstHeaderByte & 0x1) > 0; byte secondHeaderByte = channel.get(); boolean startNodeNeedsLong = (secondHeaderByte & 0x80) > 0; boolean endNodeNeedsLong = (secondHeaderByte & 0x40) > 0; int indexNameId = getUnsignedShort( channel ); int keyId = getUnsignedShort( channel ); return new IndexCommandHeader( valueType, entityType, entityIdNeedsLong, indexNameId, startNodeNeedsLong, endNodeNeedsLong, keyId ); }
private MutableObjectIntMap<String> readMap( ReadableChannel channel ) throws IOException { int size = getUnsignedShort( channel ); final MutableObjectIntMap<String> result = new ObjectIntHashMap<>( size ); for ( int i = 0; i < size; i++ ) { String key = read2bLengthAndString( channel ); int id = getUnsignedShort( channel ); if ( key == null ) { return null; } result.put( key, id ); } return result; }
private IndexCommandHeader readIndexCommandHeader( ReadableChannel channel ) throws IOException { byte firstHeaderByte = channel.get(); byte valueType = (byte) ((firstHeaderByte & 0x1C) >> 2); byte entityType = (byte) ((firstHeaderByte & 0x2) >> 1); boolean entityIdNeedsLong = (firstHeaderByte & 0x1) > 0; byte secondHeaderByte = channel.get(); boolean startNodeNeedsLong = (secondHeaderByte & 0x80) > 0; boolean endNodeNeedsLong = (secondHeaderByte & 0x40) > 0; int indexNameId = getUnsignedShort( channel ); int keyId = getUnsignedShort( channel ); return new IndexCommandHeader( valueType, entityType, entityIdNeedsLong, indexNameId, startNodeNeedsLong, endNodeNeedsLong, keyId ); }
private MutableObjectIntMap<String> readMap( ReadableChannel channel ) throws IOException { int size = getUnsignedShort( channel ); final MutableObjectIntMap<String> result = new ObjectIntHashMap<>( size ); for ( int i = 0; i < size; i++ ) { String key = read2bLengthAndString( channel ); int id = getUnsignedShort( channel ); if ( key == null ) { return null; } result.put( key, id ); } return result; }