168169170171172173174175176177178
// close the block Slice raw = blockBuilder.finish(); // attempt to compress the block Slice blockContents = raw; CompressionType blockCompressionType = CompressionType.NONE; if (compressionType == CompressionType.SNAPPY) { ensureCompressedOutputCapacity(maxCompressedLength(raw.length())); try { int compressedSize = Snappy.compress(raw.getRawArray(), raw.getRawOffset(), raw.length(), compressedOutput.getRawArray(), 0);
919293949596979899
} public static BlockTrailer readBlockTrailer(Slice slice) { SliceInput sliceInput = slice.input(); CompressionType compressionType = CompressionType.getCompressionTypeByPersistentId(sliceInput.readUnsignedByte()); int crc32c = sliceInput.readInt(); return new BlockTrailer(compressionType, crc32c); }
120121122123124125126127128129130
} this.databaseDir = databaseDir; //use custom comparator if set DBComparator comparator = options.comparator(); UserComparator userComparator; if (comparator != null) { userComparator = new CustomUserComparator(comparator); }else{ userComparator = new BytewiseComparator();
6970717273747576
try { iter.seek(key); } catch (DBException e) { throw e; } catch (RuntimeException e) { throw new DBException(e.getMessage(), e); } }
8283848586878889
try { iter.seekToFirst(); } catch (DBException e) { throw e; } catch (RuntimeException e) { throw new DBException(e.getMessage(), e); } }
9596979899100101102
try { iter.seekToLast(); } catch (DBException e) { throw e; } catch (RuntimeException e) { throw new DBException(e.getMessage(), e); } }
108109110111112113114115
try { return iter.hasNext(); } catch (DBException e) { throw e; } catch (RuntimeException e) { throw new DBException(e.getMessage(), e); } }
122123124125126127128129
try { return iter.next(); } catch (DBException e) { throw e; } catch (RuntimeException e) { throw new DBException(e.getMessage(), e); } }
136137138139140141142143
try { return iter.peekNext(); } catch (DBException e) { throw e; } catch (RuntimeException e) { throw new DBException(e.getMessage(), e); } }
149150151152153154155156
try { return iter.hasPrev(); } catch (DBException e) { throw e; } catch (RuntimeException e) { throw new DBException(e.getMessage(), e); } }