name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
hbase_ThrottledInputStream_getBytesPerSec_rdh
/** * Getter for the read-rate from this stream, since creation. Calculated as * bytesRead/elapsedTimeSinceStart. * * @return Read rate, in bytes/sec. */ public long getBytesPerSec() { long elapsed = (EnvironmentEdgeManager.currentTime() - startTime) / 1000; if (elapsed == 0) { return bytesRead; } else { return bytesRead / elapsed; } }
3.26
hbase_ThrottledInputStream_getTotalBytesRead_rdh
/** * Getter for the number of bytes read from this stream, since creation. * * @return The number of bytes. */ public long getTotalBytesRead() { return bytesRead; }
3.26
hbase_ThrottledInputStream_getTotalSleepTime_rdh
/** * Getter the total time spent in sleep. * * @return Number of milliseconds spent in sleep. */ public long getTotalSleepTime() { return totalSleepTime; }
3.26
hbase_BlockCacheUtil_toJSON_rdh
/** * Returns JSON string of <code>bc</code> content. */public static String toJSON(BlockCache bc) throws IOException { return GSON.toJson(bc); }
3.26
hbase_BlockCacheUtil_toString_rdh
/** * Returns The block content as String. */ public static String toString(final CachedBlock cb, final long now) { return (("filename=" + cb.getFilename()) + ", ") + toStringMinusFileName(cb, now); }
3.26
hbase_BlockCacheUtil_update_rdh
/** * Returns True if full.... if we won't be adding any more. */ public boolean update(final CachedBlock cb) { if (isFull()) return true; NavigableSet<CachedBlock> set = this.cachedBlockByFile.get(cb.getFilename()); if (set == null) { set = new ConcurrentSkipListSet<>(); this.cachedBlockByFile.put(cb.getFilename(), set); } set.add(cb); this.size += cb.getSize(); this.count++; BlockType bt = cb.getBlockType(); if ((bt != null) && bt.isData()) { this.dataBlockCount++; this.dataSize += cb.getSize(); } long age = (this.now - cb.getCachedTime()) / NANOS_PER_SECOND; this.hist.add(age, 1); return false; }
3.26
hbase_BlockCacheUtil_validateBlockAddition_rdh
/** * Validate that the existing and newBlock are the same without including the nextBlockMetadata, * if not, throw an exception. If they are the same without the nextBlockMetadata, return the * comparison. * * @param existing * block that is existing in the cache. * @param newBlock * block that is trying to be cached. * @param cacheKey * the cache key of the blocks. * @return comparison of the existing block to the newBlock. */ public static int validateBlockAddition(Cacheable existing, Cacheable newBlock, BlockCacheKey cacheKey) { int comparison = compareCacheBlock(existing, newBlock, false); if (comparison != 0) { throw new RuntimeException(("Cached block contents differ, which should not have happened." + "cacheKey:") + cacheKey); } if ((existing instanceof HFileBlock) && (newBlock instanceof HFileBlock)) { comparison = ((HFileBlock) (existing)).getNextBlockOnDiskSize() - ((HFileBlock) (newBlock)).getNextBlockOnDiskSize(); } return comparison; }
3.26
hbase_BlockCacheUtil_getSize_rdh
/** * Returns size of blocks in the cache */ public long getSize() { return size; }
3.26
hbase_BlockCacheUtil_getLoadedCachedBlocksByFile_rdh
/** * Get a {@link CachedBlocksByFile} instance and load it up by iterating content in * {@link BlockCache}. * * @param conf * Used to read configurations * @param bc * Block Cache to iterate. * @return Laoded up instance of CachedBlocksByFile */ public static CachedBlocksByFile getLoadedCachedBlocksByFile(final Configuration conf, final BlockCache bc) { CachedBlocksByFile cbsbf = new CachedBlocksByFile(conf); for (CachedBlock cb : bc) { if (cbsbf.update(cb)) break; } return cbsbf; }
3.26
hbase_BlockCacheUtil_toStringMinusFileName_rdh
/** * Returns The block content of <code>bc</code> as a String minus the filename. */ public static String toStringMinusFileName(final CachedBlock cb, final long now) { return (((((((("offset=" + cb.getOffset()) + ", size=") + cb.getSize()) + ", age=") + (now - cb.getCachedTime())) + ", type=") + cb.getBlockType()) + ", priority=") + cb.getBlockPriority(); }
3.26
hbase_BlockCacheUtil_getDataSize_rdh
/** * Returns Size of data. */ public long getDataSize() {return dataSize; }
3.26
hbase_Export_main_rdh
/** * Main entry point. * * @param args * The command line parameters. * @throws Exception * When running the job fails. */ public static void main(String[] args) throws Exception { int errCode = ToolRunner.run(HBaseConfiguration.create(), new Export(), args); System.exit(errCode); }
3.26
hbase_Export_createSubmittableJob_rdh
/** * Sets up the actual job. * * @param conf * The current configuration. * @param args * The command line parameters. * @return The newly created job. * @throws IOException * When setting up the job fails. */ public static Job createSubmittableJob(Configuration conf, String[] args) throws IOException { Triple<TableName, Scan, Path> arguments = ExportUtils.getArgumentsFromCommandLine(conf, args); String tableName = arguments.getFirst().getNameAsString(); Path outputDir = arguments.getThird();Job job = Job.getInstance(conf, conf.get(JOB_NAME_CONF_KEY, (NAME + "_") + tableName)); job.setJobName((NAME + "_") + tableName); job.setJarByClass(Export.class); // Set optional scan parameters Scan s = arguments.getSecond(); IdentityTableMapper.initJob(tableName, s, IdentityTableMapper.class, job); // No reducers. Just write straight to output files. job.setNumReduceTasks(0); job.setOutputFormatClass(SequenceFileOutputFormat.class);job.setOutputKeyClass(ImmutableBytesWritable.class); job.setOutputValueClass(Result.class); FileOutputFormat.setOutputPath(job, outputDir);// job conf doesn't contain the conf so doesn't // have a default fs. return job;}
3.26
hbase_BoundedGroupingStrategy_getAndIncrAtomicInteger_rdh
// Non-blocking incrementing & resetting of AtomicInteger. private int getAndIncrAtomicInteger(AtomicInteger atomicInt, int reset) { for (; ;) { int current = atomicInt.get(); int next = current + 1; if (next == reset) {next = 0; } if (atomicInt.compareAndSet(current, next)) return current; } }
3.26
hbase_AbstractProcedureScheduler_schedLock_rdh
// ========================================================================== // Internal helpers // ========================================================================== protected void schedLock() { schedulerLock.lock(); }
3.26
hbase_AbstractProcedureScheduler_getPollCalls_rdh
// ============================================================================ // TODO: Metrics // ============================================================================ public long getPollCalls() { return pollCalls; }
3.26
hbase_AbstractProcedureScheduler_wakeEvents_rdh
// ========================================================================== // Procedure Events // ========================================================================== /** * Wake up all of the given events. Note that we first take scheduler lock and then wakeInternal() * synchronizes on the event. Access should remain package-private. Use ProcedureEvent class to * wake/suspend events. * * @param events * the list of events to wake */ public void wakeEvents(ProcedureEvent[] events) { schedLock(); try { for (ProcedureEvent event : events) { if (event == null) { continue; } event.wakeInternal(this); }} finally {schedUnlock(); } }
3.26
hbase_AbstractProcedureScheduler_wakeWaitingProcedures_rdh
/** * Wakes up given waiting procedures by pushing them back into scheduler queues. * * @return size of given {@code waitQueue}. */ protected int wakeWaitingProcedures(LockAndQueue lockAndQueue) { return lockAndQueue.wakeWaitingProcedures(this); }
3.26
hbase_ConnectionCache_getClusterId_rdh
/** * Returns Cluster ID for the HBase cluster or null if there is an err making the connection. */ public String getClusterId() { try { ConnectionInfo connInfo = getCurrentConnection(); return connInfo.connection.getClusterId(); } catch (IOException e) { LOG.error("Error getting connection: ", e); } return null; }
3.26
hbase_ConnectionCache_getTable_rdh
/** * Caller closes the table afterwards. */ public Table getTable(String tableName) throws IOException { ConnectionInfo connInfo = getCurrentConnection(); return connInfo.connection.getTable(TableName.valueOf(tableName)); }
3.26
hbase_ConnectionCache_shutdown_rdh
/** * Called when cache is no longer needed so that it can perform cleanup operations */ public void shutdown() { if (choreService != null) choreService.shutdown(); }
3.26
hbase_ConnectionCache_setEffectiveUser_rdh
/** * Set the current thread local effective user */ public void setEffectiveUser(String user) { effectiveUserNames.set(user); }
3.26
hbase_ConnectionCache_getAdmin_rdh
/** * Caller doesn't close the admin afterwards. We need to manage it and close it properly. */ public Admin getAdmin() throws IOException { ConnectionInfo connInfo = getCurrentConnection(); if (connInfo.admin == null) { Lock lock = locker.acquireLock(getEffectiveUser()); try { if (connInfo.admin == null) { connInfo.admin = connInfo.connection.getAdmin(); } } finally { lock.unlock(); } } return connInfo.admin; }
3.26
hbase_ConnectionCache_getRegionLocator_rdh
/** * Retrieve a regionLocator for the table. The user should close the RegionLocator. */public RegionLocator getRegionLocator(byte[] tableName) throws IOException { return getCurrentConnection().connection.getRegionLocator(TableName.valueOf(tableName)); }
3.26
hbase_ConnectionCache_getCurrentConnection_rdh
/** * Get the cached connection for the current user. If none or timed out, create a new one. */ ConnectionInfo getCurrentConnection() throws IOException {String userName = getEffectiveUser(); ConnectionInfo connInfo = connections.get(userName); if ((connInfo == null) || (!connInfo.updateAccessTime())) { Lock lock = locker.acquireLock(userName); try { connInfo = connections.get(userName); if (connInfo == null) { UserGroupInformation ugi = realUser; if (!userName.equals(realUserName)) { ugi = UserGroupInformation.createProxyUser(userName, realUser); }User user = userProvider.create(ugi); Connection conn = ConnectionFactory.createConnection(conf, user); connInfo = new ConnectionInfo(conn, userName); connections.put(userName, connInfo);} } finally { lock.unlock();} } return connInfo; }
3.26
hbase_ConnectionCache_getEffectiveUser_rdh
/** * Get the current thread local effective user */ public String getEffectiveUser() { return effectiveUserNames.get(); }
3.26
hbase_Bytes_toShort_rdh
/** * Converts a byte array to a short value * * @param bytes * byte array * @param offset * offset into array * @param length * length, has to be {@link #SIZEOF_SHORT} * @return the short value * @throws IllegalArgumentException * if length is not {@link #SIZEOF_SHORT} or if there's not * enough room in the array at the offset indicated. */ public static short toShort(byte[] bytes, int offset, final int length) { if ((length != SIZEOF_SHORT) || ((offset + length) > bytes.length)) { throw explainWrongLengthOrOffset(bytes, offset, length, SIZEOF_SHORT); } return ConverterHolder.BEST_CONVERTER.toShort(bytes, offset, length); }
3.26
hbase_Bytes_toLong_rdh
/** * Converts a byte array to a long value. * * @param bytes * array of bytes * @param offset * offset into array * @param length * length of data (must be {@link #SIZEOF_LONG}) * @return the long value * @throws IllegalArgumentException * if length is not {@link #SIZEOF_LONG} or if there's not enough * room in the array at the offset indicated. */ public static long toLong(byte[] bytes, int offset, final int length) { if ((length != SIZEOF_LONG) || ((offset + length) > bytes.length)) { throw explainWrongLengthOrOffset(bytes, offset, length, SIZEOF_LONG); } return ConverterHolder.BEST_CONVERTER.toLong(bytes, offset, length); }
3.26
hbase_Bytes_fromHex_rdh
/** * Create a byte array from a string of hash digits. The length of the string must be a multiple * of 2 */ public static byte[] fromHex(String hex) { checkArgument((hex.length() % 2) == 0, "length must be a multiple of 2"); int len = hex.length(); byte[] b = new byte[len / 2]; for (int i = 0; i < len; i += 2) { b[i / 2] = hexCharsToByte(hex.charAt(i), hex.charAt(i + 1)); } return b; }
3.26
hbase_Bytes_writeStringFixedSize_rdh
/** * Writes a string as a fixed-size field, padded with zeros. */ public static void writeStringFixedSize(final DataOutput out, String s, int size) throws IOException { byte[] b = toBytes(s); if (b.length > size) { throw new IOException((((("Trying to write " + b.length) + " bytes (") + toStringBinary(b)) + ") into a field of length ") + size);} out.writeBytes(s); for (int i = 0; i < (size - s.length()); ++i) out.writeByte(0); }
3.26
hbase_Bytes_searchDelimiterIndexInReverse_rdh
/** * Find index of passed delimiter walking from end of buffer backwards. * * @return Index of delimiter */ public static int searchDelimiterIndexInReverse(final byte[] b, final int offset, final int length, final int delimiter) { if (b == null) { throw new IllegalArgumentException("Passed buffer is null"); } int result = -1; for (int i = (offset + length) - 1; i >= offset; i--) { if (b[i] == delimiter) { result = i; break; } } return result; }
3.26
hbase_Bytes_indexOf_rdh
/** * Returns the start position of the first occurrence of the specified {@code target} within {@code array}, or {@code -1} if there is no such occurrence. * <p> * More formally, returns the lowest index {@code i} such that {@code java.util.Arrays.copyOfRange(array, i, i + target.length)} contains exactly the same elements * as {@code target}. * * @param array * the array to search for the sequence {@code target} * @param target * the array to search for as a sub-sequence of {@code array} */ public static int indexOf(byte[] array, byte[] target) { checkNotNull(array, "array"); checkNotNull(target, "target"); if (target.length == 0) { return 0; } outer : for (int i = 0; i < ((array.length - target.length) + 1); i++) { for (int v180 = 0; v180 < target.length; v180++) { if (array[i + v180] != target[v180]) { continue outer; } } return i; } return -1; }
3.26
hbase_Bytes_toBoolean_rdh
/** * Reverses {@link #toBytes(boolean)} * * @param b * array * @return True or false. */public static boolean toBoolean(final byte[] b) { if (b.length != 1) { throw new IllegalArgumentException("Array has wrong size: " + b.length); } return b[0] != ((byte) (0)); }
3.26
hbase_Bytes_hashCode_rdh
/** * Calculate the hash code for a given range of bytes. * * @param bytes * array to hash * @param offset * offset to start from * @param length * length to hash */ public static int hashCode(byte[] bytes, int offset, int length) { int hash = 1; for (int i = offset; i < (offset + length); i++) hash = (31 * hash) + bytes[i]; return hash; }
3.26
hbase_Bytes_equals_rdh
/** * Lexicographically determine the equality of two arrays. * * @param left * left operand * @param leftOffset * offset into left operand * @param leftLen * length of left operand * @param right * right operand * @param rightOffset * offset into right operand * @param rightLen * length of right operand * @return True if equal */ public static boolean equals(final byte[] left, int leftOffset, int leftLen, final byte[] right, int rightOffset, int rightLen) { // short circuit case if (((left == right) && (leftOffset == rightOffset)) && (leftLen == rightLen)) { return true; } // different lengths fast check if (leftLen != rightLen) { return false; } if (leftLen == 0) { return true; } // Since we're often comparing adjacent sorted data, // it's usual to have equal arrays except for the very last byte // so check that first if (left[(leftOffset + leftLen) - 1] != right[(rightOffset + rightLen) - 1]) return false; return LexicographicalComparerHolder.BEST_COMPARER.compareTo(left, leftOffset, leftLen, right, rightOffset, rightLen) == 0; }
3.26
hbase_Bytes_readByteArrayThrowsRuntime_rdh
/** * Read byte-array written with a WritableableUtils.vint prefix. IOException is converted to a * RuntimeException. * * @param in * Input to read from. * @return byte array read off <code>in</code> */ public static byte[] readByteArrayThrowsRuntime(final DataInput in) { try { return readByteArray(in); } catch (Exception e) { throw new RuntimeException(e); } }
3.26
hbase_Bytes_getLength_rdh
/** * Returns the number of valid bytes in the buffer */ public int getLength() { if (this.bytes == null) { throw new IllegalStateException("Uninitialiized. Null constructor " + "called w/o accompaying readFields invocation"); }return this.length; }
3.26
hbase_Bytes_random_rdh
/** * Fill given array with random bytes at the specified position. * <p> * If you want random bytes generated by a strong source of randomness use * {@link Bytes#secureRandom(byte[], int, int)}. * * @param b * array which needs to be filled with random bytes * @param offset * staring offset in array * @param length * number of bytes to fill */ public static void random(byte[] b, int offset, int length) { checkPositionIndex(offset, b.length, "offset"); checkArgument(length > 0, "length must be greater than 0"); checkPositionIndex(offset + length, b.length, "offset + length"); byte[] buf = new byte[length]; RNG.nextBytes(buf); System.arraycopy(buf, 0, b, offset, length); }
3.26
hbase_Bytes_toFloat_rdh
/** * Put a float value out to the specified byte array position. Presumes float encoded as IEEE 754 * floating-point "single format" * * @param bytes * array to convert * @param offset * offset into array * @return Float made from passed byte array. */ public static float toFloat(byte[] bytes, int offset) { return Float.intBitsToFloat(toInt(bytes, offset, f0)); }
3.26
hbase_Bytes_m2_rdh
/** * Converts a byte array to a BigDecimal value */ public static BigDecimal m2(byte[] bytes, int offset, final int length) { if (((bytes == null) || (length < (f0 + 1))) || ((offset + length) > bytes.length)) { return null; } int scale = toInt(bytes, offset); byte[] tcBytes = new byte[length - f0]; System.arraycopy(bytes, offset + f0, tcBytes, 0, length - f0); return new BigDecimal(new BigInteger(tcBytes), scale); }
3.26
hbase_Bytes_tail_rdh
/** * Make a new byte array from a subset of bytes at the tail of another. * * @param a * array * @param length * amount of bytes to snarf * @return Last <code>length</code> bytes from <code>a</code> */ public static byte[] tail(final byte[] a, final int length) { if (a.length < length) { return null;} byte[] result = new byte[length]; System.arraycopy(a, a.length - length, result, 0, length); return result; }
3.26
hbase_Bytes_readAsVLong_rdh
/** * Reads a zero-compressed encoded long from input buffer and returns it. * * @param buffer * Binary array * @param offset * Offset into array at which vint begins. * @return deserialized long from buffer. */ public static long readAsVLong(final byte[] buffer, final int offset) { byte firstByte = buffer[offset]; int len = WritableUtils.decodeVIntSize(firstByte); if (len == 1) { return firstByte; } long i = 0; for (int idx = 0; idx < (len - 1); idx++) { byte b = buffer[(offset + 1) + idx]; i = i << 8; i = i | (b & 0xff); } return WritableUtils.isNegativeVInt(firstByte) ? ~i : i; }
3.26
hbase_Bytes_toArray_rdh
/** * Convert a list of byte[] to an array * * @param array * List of byte []. * @return Array of byte []. */ public static byte[][] toArray(final List<byte[]> array) { // List#toArray doesn't work on lists of byte []. byte[][] results = new byte[array.size()][]; for (int i = 0; i < array.size(); i++) { results[i] = array.get(i); } return results; }
3.26
hbase_Bytes_iterateOnSplits_rdh
/** * Iterate over keys within the passed range. */ public static Iterable<byte[]> iterateOnSplits(final byte[] a, final byte[] b, boolean inclusive, final int num) { byte[] v116; byte[] bPadded; if (a.length < b.length) { v116 = padTail(a, b.length - a.length); bPadded = b; } else if (b.length < a.length) { v116 = a; bPadded = padTail(b, a.length - b.length); } else { v116 = a; bPadded = b; } if (compareTo(v116, bPadded) >= 0) { throw new IllegalArgumentException("b <= a"); } if (num <= 0) { throw new IllegalArgumentException("num cannot be <= 0");} byte[] prependHeader = new byte[]{ 1, 0 };final BigInteger startBI = new BigInteger(add(prependHeader, v116)); final BigInteger stopBI = new BigInteger(add(prependHeader, bPadded)); BigInteger diffBI = stopBI.subtract(startBI); if (inclusive) { diffBI = diffBI.add(BigInteger.ONE); } final BigInteger splitsBI = BigInteger.valueOf(num + 1); // when diffBI < splitBI, use an additional byte to increase diffBI if (diffBI.compareTo(splitsBI) < 0) { byte[] aPaddedAdditional = new byte[v116.length + 1];byte[] bPaddedAdditional = new byte[bPadded.length + 1]; for (int i = 0; i < v116.length; i++) {aPaddedAdditional[i] = v116[i]; }for (int j = 0; j < bPadded.length; j++) { bPaddedAdditional[j] = bPadded[j]; } aPaddedAdditional[v116.length] = 0; bPaddedAdditional[bPadded.length] = 0; return iterateOnSplits(aPaddedAdditional, bPaddedAdditional, inclusive, num); } final BigInteger intervalBI; try { intervalBI = diffBI.divide(splitsBI); } catch (Exception e) { LOG.error("Exception caught during division", e); return null; } final Iterator<byte[]> iterator = new Iterator<byte[]>() { private int i = -1; @Override public boolean hasNext() { return i < (num + 1); } @Override public byte[] next() { i++; if (i == 0) return a; if (i == (num + 1)) return b; BigInteger curBI = startBI.add(intervalBI.multiply(BigInteger.valueOf(i))); byte[] padded = curBI.toByteArray(); if (padded[1] == 0) padded = tail(padded, padded.length - 2); else padded = tail(padded, padded.length - 1); return padded; } @Override public void remove() { throw new UnsupportedOperationException(); } }; return new Iterable<byte[]>() { @Override public Iterator<byte[]> iterator() { return iterator; } }; }
3.26
hbase_Bytes_putByte_rdh
/** * Write a single byte out to the specified byte array position. * * @param bytes * the byte array * @param offset * position in the array * @param b * byte to write out * @return incremented offset */ public static int putByte(byte[] bytes, int offset, byte b) { bytes[offset] = b; return offset + 1; }
3.26
hbase_Bytes_toDouble_rdh
/** * Return double made from passed bytes. */ public static double toDouble(final byte[] bytes, final int offset) { return Double.longBitsToDouble(toLong(bytes, offset, SIZEOF_LONG)); }
3.26
hbase_Bytes_padHead_rdh
/** * Make a new byte array from a subset of bytes at the head of another, zero padded as desired. * * @param a * array * @param length * new array size * @return Value in <code>a</code> plus <code>length</code> prepended 0 bytes */ public static byte[] padHead(final byte[] a, final int length) { byte[] v108 = new byte[length]; for (int i = 0; i < length; i++) { v108[i] = 0; } return add(v108, a); }
3.26
hbase_Bytes_getBytes_rdh
/** * Returns a new byte array, copied from the given {@code buf}, from the position (inclusive) to * the limit (exclusive). The position and the other index parameters are not changed. * * @param buf * a byte buffer * @return the byte array * @see #toBytes(ByteBuffer) */public static byte[] getBytes(ByteBuffer buf) { return readBytes(buf.duplicate()); }
3.26
hbase_Bytes_putAsShort_rdh
/** * Put an int value as short out to the specified byte array position. Only the lower 2 bytes of * the short will be put into the array. The caller of the API need to make sure they will not * loose the value by doing so. This is useful to store an unsigned short which is represented as * int in other parts. * * @param bytes * the byte array * @param offset * position in the array * @param val * value to write out * @return incremented offset * @throws IllegalArgumentException * if the byte array given doesn't have enough room at the offset * specified. */ public static int putAsShort(byte[] bytes, int offset, int val) { if ((bytes.length - offset) < SIZEOF_SHORT) { throw new IllegalArgumentException((((("Not enough room to put a short at" + " offset ") + offset) + " in a ") + bytes.length) + " byte array"); } bytes[offset + 1] = ((byte) (val)); val >>= 8; bytes[offset] = ((byte) (val)); return offset + SIZEOF_SHORT; }
3.26
hbase_Bytes_vintToBytes_rdh
/** * Encode a long value as a variable length integer. * * @param vint * Integer to make a vint of. * @return Vint as bytes array. */ public static byte[] vintToBytes(final long vint) { long i = vint; int size = WritableUtils.getVIntSize(i); byte[] result = new byte[size];int offset = 0; if ((i >= (-112)) && (i <= 127)) { result[offset] = ((byte) (i)); return result; } int len = -112; if (i < 0) { i ^= -1L;// take one's complement' len = -120; } long tmp = i; while (tmp != 0) { tmp = tmp >> 8; len--; } result[offset++] = ((byte) (len)); len = (len < (-120)) ? -(len + 120) : -(len + 112); for (int idx = len; idx != 0; idx--) { int shiftbits = (idx - 1) * 8; long mask = 0xffL << shiftbits; result[offset++] = ((byte) ((i & mask) >> shiftbits)); } return result; }
3.26
hbase_Bytes_len_rdh
/** * Returns length of the byte array, returning 0 if the array is null. Useful for calculating * sizes. * * @param b * byte array, which can be null * @return 0 if b is null, otherwise returns length */
3.26
hbase_Bytes_mapKey_rdh
/** * Calculate a hash code from a given byte array suitable for use as a key in maps. * * @param b * bytes to hash * @param length * length to hash * @return A hash of <code>b</code> as an Integer that can be used as key in Maps. */ public static Integer mapKey(final byte[] b, final int length) { return hashCode(b, length); }
3.26
hbase_Bytes_readStringFixedSize_rdh
/** * Reads a fixed-size field and interprets it as a string padded with zeros. */public static String readStringFixedSize(final DataInput in, int size) throws IOException {byte[] b = new byte[size]; in.readFully(b); int n = b.length; while ((n > 0) && (b[n - 1] == 0)) --n; return toString(b, 0, n); }
3.26
hbase_Bytes_readByteArray_rdh
/** * Read byte-array written with a WritableableUtils.vint prefix. * * @param in * Input to read from. * @return byte array read off <code>in</code> * @throws IOException * e */ public static byte[] readByteArray(final DataInput in) throws IOException { int len = WritableUtils.readVInt(in); if (len < 0) {throw new NegativeArraySizeException(Integer.toString(len)); } byte[] result = new byte[len]; in.readFully(result, 0, len); return result; }
3.26
hbase_Bytes_getBestComparer_rdh
/** * Returns the Unsafe-using Comparer, or falls back to the pure-Java implementation if unable to * do so. */ static Comparer<byte[]> getBestComparer() { try { Class<?> theClass = Class.forName(UNSAFE_COMPARER_NAME); // yes, UnsafeComparer does implement Comparer<byte[]> @SuppressWarnings("unchecked") Comparer<byte[]> comparer = ((Comparer<byte[]>) (theClass.getEnumConstants()[0])); return comparer; } catch (Throwable t) { // ensure we really catch *everything* return lexicographicalComparerJavaImpl(); }}
3.26
hbase_Bytes_binaryIncrementPos_rdh
/* increment/deincrement for positive value */ private static byte[] binaryIncrementPos(byte[] value, long amount) { long amo = amount; int sign = 1; if (amount < 0) { amo = -amount; sign = -1; } for (int i = 0; i < value.length; i++) { int cur = (((int) (amo)) % 256) * sign; amo = amo >> 8; int val = value[(value.length - i) - 1] & 0xff; int total = val + cur; if (total > 255) { amo += sign; total %= 256; } else if (total < 0) { amo -= sign; } value[(value.length - i) - 1] = ((byte) (total));if (amo == 0) return value; } return value; }
3.26
hbase_Bytes_toString_rdh
/** * This method will convert utf8 encoded bytes into a string. If the given byte array is null, * this method will return null. * * @param b * Presumed UTF-8 encoded byte array. * @param off * offset into array * @param len * length of utf-8 sequence * @return String made from <code>b</code> or null */ public static String toString(final byte[] b, int off, int len) { if (b == null) { return null; }if (len == 0) { return ""; } try { return new String(b, off, len, UTF8_CSN); } catch (UnsupportedEncodingException e) { // should never happen! throw new IllegalArgumentException("UTF8 encoding is not supported", e); } }
3.26
hbase_Bytes_incrementBytes_rdh
/** * Bytewise binary increment/deincrement of long contained in byte array on given amount. * * @param value * - array of bytes containing long (length &lt;= SIZEOF_LONG) * @param amount * value will be incremented on (deincremented if negative) * @return array of bytes containing incremented long (length == SIZEOF_LONG) */ public static byte[] incrementBytes(byte[] value, long amount) { byte[] val = value; if (val.length < SIZEOF_LONG) { // Hopefully this doesn't happen too often. byte[] newvalue; if (val[0] < 0) { newvalue = new byte[]{ -1, -1, -1, -1, -1, -1, -1, -1 }; } else { newvalue = new byte[SIZEOF_LONG]; } System.arraycopy(val, 0, newvalue, newvalue.length - val.length, val.length); val = newvalue; } else if (val.length > SIZEOF_LONG) { throw new IllegalArgumentException("Increment Bytes - value too big: " + val.length); } if (amount == 0) return val; if (val[0] < 0) {return m5(val, amount); } return binaryIncrementPos(val, amount); }
3.26
hbase_Bytes_startsWith_rdh
/** * Return true if the byte array on the right is a prefix of the byte array on the left. */ public static boolean startsWith(byte[] bytes, byte[] prefix) { return (((bytes != null) && (prefix != null)) && (bytes.length >= prefix.length)) && (LexicographicalComparerHolder.BEST_COMPARER.compareTo(bytes, 0, prefix.length, prefix, 0, prefix.length) == 0); } /** * Calculate a hash code from a given byte array. * * @param b * bytes to hash * @return Runs {@link WritableComparator#hashBytes(byte[], int)} on the passed in array. This method is what {@link org.apache.hadoop.io.Text}
3.26
hbase_Bytes_toBytes_rdh
/** * Convert a BigDecimal value to a byte array */ public static byte[] toBytes(BigDecimal val) { byte[] valueBytes = val.unscaledValue().toByteArray(); byte[] result = new byte[valueBytes.length + f0]; int offset = putInt(result, 0, val.scale()); putBytes(result, offset, valueBytes, 0, valueBytes.length); return result; }
3.26
hbase_Bytes_copy_rdh
/** * Copy the byte array given in parameter and return an instance of a new byte array with the same * length and the same content. * * @param bytes * the byte array to copy from * @return a copy of the given designated byte array */public static byte[] copy(byte[] bytes, final int offset, final int length) { if (bytes == null) return null; byte[] result = new byte[length]; System.arraycopy(bytes, offset, result, 0, length); return result; }
3.26
hbase_Bytes_multiple_rdh
/** * Create a byte array which is multiple given bytes * * @return byte array */ public static byte[] multiple(byte[] srcBytes, int multiNum) { if (multiNum <= 0) { return new byte[0]; } byte[] result = new byte[srcBytes.length * multiNum]; for (int i = 0; i < multiNum; i++) { System.arraycopy(srcBytes, 0, result, i * srcBytes.length, srcBytes.length); } return result; }
3.26
hbase_Bytes_writeByteArray_rdh
/** * Write byte-array to out with a vint length prefix. * * @param out * output stream * @param b * array * @param offset * offset into array * @param length * length past offset * @throws IOException * e */ public static void writeByteArray(final DataOutput out, final byte[] b, final int offset, final int length) throws IOException { WritableUtils.writeVInt(out, length); out.write(b, offset, length); }
3.26
hbase_Bytes_set_rdh
/** * Use passed bytes as backing array for this instance. */ public void set(final byte[] b, final int offset, final int length) { this.bytes = b; this.offset = offset; this.length = length; }
3.26
hbase_Bytes_toBinaryByteArrays_rdh
/** * Create an array of byte[] given an array of String. * * @param t * operands * @return Array of binary byte arrays made from passed array of binary strings */ public static byte[][] toBinaryByteArrays(final String[] t) { byte[][] result = new byte[t.length][]; for (int i = 0; i < t.length; i++) { result[i] = Bytes.toBytesBinary(t[i]); } return result; }
3.26
hbase_Bytes_zero_rdh
/** * Fill given array with zeros at the specified position. */ public static void zero(byte[] b, int offset, int length) { checkPositionIndex(offset, b.length, "offset");checkArgument(length > 0, "length must be greater than 0"); checkPositionIndex(offset + length, b.length, "offset + length");Arrays.fill(b, offset, offset + length, ((byte) (0))); }
3.26
hbase_Bytes_m1_rdh
/** * Write byte-array with a WritableableUtils.vint prefix. * * @param out * output stream to be written to * @param b * array to write * @throws IOException * e */ public static void m1(final DataOutput out, final byte[] b) throws IOException { if (b == null) { WritableUtils.writeVInt(out, 0); } else { writeByteArray(out, b, 0, b.length); } }
3.26
hbase_Bytes_searchDelimiterIndex_rdh
/** * Find index of passed delimiter. * * @return Index of delimiter having started from start of <code>b</code> moving rightward. */ public static int searchDelimiterIndex(final byte[] b, int offset, final int length, final int delimiter) { if (b == null) { throw new IllegalArgumentException("Passed buffer is null"); } int v194 = -1; for (int i = offset; i < (length + offset); i++) { if (b[i] == delimiter) { v194 = i;break; } } return v194; }
3.26
hbase_Bytes_putDouble_rdh
/** * Put a double value out to the specified byte array position as the IEEE 754 double format. * * @param bytes * byte array * @param offset * offset to write to * @param d * value * @return New offset into array <code>bytes</code> */ public static int putDouble(byte[] bytes, int offset, double d) { return putLong(bytes, offset, Double.doubleToLongBits(d)); }
3.26
hbase_Bytes_add_rdh
/** * Concatenate byte arrays. * * @param arrays * all the arrays to concatenate together. * @return New array made from the concatenation of the given arrays. */ public static byte[] add(final byte[][] arrays) { int length = 0; for (int i = 0; i < arrays.length; i++) { length += arrays[i].length; } byte[] result = new byte[length]; int index = 0; for (int i = 0; i < arrays.length; i++) { System.arraycopy(arrays[i], 0, result, index, arrays[i].length); index += arrays[i].length; } return result; }
3.26
hbase_Bytes_toBinaryFromHex_rdh
/** * Takes a ASCII digit in the range A-F0-9 and returns the corresponding integer/ordinal value. * * @param ch * The hex digit. * @return The converted hex value as a byte. */ public static byte toBinaryFromHex(byte ch) { if ((ch >= 'A') && (ch <= 'F')) return ((byte) (((byte) (10)) + ((byte) (ch - 'A')))); // else return ((byte) (ch - '0')); }
3.26
hbase_Bytes_toStringBinary_rdh
/** * Write a printable representation of a byte array. Non-printable characters are hex escaped in * the format \\x%02X, eg: \x00 \x05 etc * * @param b * array to write out * @param off * offset to start at * @param len * length to write * @return string output */ public static String toStringBinary(final byte[] b, int off, int len) { StringBuilder result = new StringBuilder(); // Just in case we are passed a 'len' that is > buffer length... if (off >= b.length) return result.toString(); if ((off + len) > b.length) len = b.length - off; for (int v11 = off; v11 < (off + len); ++v11) { int ch = b[v11] & 0xff; if (((ch >= ' ') && (ch <= '~')) && (ch != '\\')) { result.append(((char) (ch))); } else { result.append("\\x"); result.append(HEX_CHARS_UPPER[ch / 0x10]); result.append(HEX_CHARS_UPPER[ch % 0x10]); } } return result.toString(); }
3.26
hbase_Bytes_get_rdh
/** * Get the data from the Bytes. * * @return The data is only valid between offset and offset+length. */ public byte[] get() { if (this.bytes == null) { throw new IllegalStateException("Uninitialiized. Null constructor " + "called w/o accompaying readFields invocation");} return this.bytes; }
3.26
hbase_Bytes_createMaxByteArray_rdh
/** * Create a max byte array with the specified max byte count * * @param maxByteCount * the length of returned byte array * @return the created max byte array */ public static byte[] createMaxByteArray(int maxByteCount) { byte[] maxByteArray = new byte[maxByteCount]; for (int i = 0; i < maxByteArray.length; i++) { maxByteArray[i] = ((byte) (0xff)); } return maxByteArray; }
3.26
hbase_Bytes_readAsInt_rdh
/** * Converts a byte array to an int value * * @param bytes * byte array * @param offset * offset into array * @param length * how many bytes should be considered for creating int * @return the int value * @throws IllegalArgumentException * if there's not enough room in the array at the offset * indicated. */ public static int readAsInt(byte[] bytes, int offset, final int length) { if ((offset + length) > bytes.length) { throw new IllegalArgumentException(((((("offset (" + offset) + ") + length (") + length) + ") exceed the") + " capacity of the array: ") + bytes.length); } int n = 0; for (int v27 = offset; v27 < (offset + length); v27++) { n <<= 8; n ^= bytes[v27] & 0xff;} return n; }
3.26
hbase_Bytes_bytesToVint_rdh
/** * Reads a zero-compressed encoded long from input buffer and returns it. * * @param buffer * buffer to convert * @return vint bytes as an integer. */ public static long bytesToVint(final byte[] buffer) { int offset = 0; byte firstByte = buffer[offset++]; int len = WritableUtils.decodeVIntSize(firstByte); if (len == 1) { return firstByte; } long i = 0; for (int idx = 0; idx < (len - 1); idx++) { byte b = buffer[offset++]; i = i << 8; i = i | (b & 0xff); } return WritableUtils.isNegativeVInt(firstByte) ? ~i : i; }
3.26
hbase_Bytes_contains_rdh
/** * Return true if target is present as an element anywhere in the given array. * * @param array * an array of {@code byte} values, possibly empty * @param target * an array of {@code byte} * @return {@code true} if {@code target} is present anywhere in {@code array} */ public static boolean contains(byte[] array, byte[] target) { return indexOf(array, target) > (-1); }
3.26
hbase_Bytes_secureRandom_rdh
/** * Fill given array with random bytes at the specified position using a strong random number * generator. * * @param b * array which needs to be filled with random bytes * @param offset * staring offset in array * @param length * number of bytes to fill */ public static void secureRandom(byte[] b, int offset, int length) { checkPositionIndex(offset, b.length, "offset"); checkArgument(length > 0, "length must be greater than 0"); checkPositionIndex(offset + length, b.length, "offset + length"); byte[] buf = new byte[length]; SECURE_RNG.nextBytes(buf); System.arraycopy(buf, 0, b, offset, length); }
3.26
hbase_Bytes_putBytes_rdh
/** * Put bytes at the specified byte array position. * * @param tgtBytes * the byte array * @param tgtOffset * position in the array * @param srcBytes * array to write out * @param srcOffset * source offset * @param srcLength * source length * @return incremented offset */ public static int putBytes(byte[] tgtBytes, int tgtOffset, byte[] srcBytes, int srcOffset, int srcLength) {System.arraycopy(srcBytes, srcOffset, tgtBytes, tgtOffset, srcLength); return tgtOffset + srcLength; }
3.26
hbase_Bytes_putLong_rdh
/** * Put a long value out to the specified byte array position. * * @param bytes * the byte array * @param offset * position in the array * @param val * long to write out * @return incremented offset * @throws IllegalArgumentException * if the byte array given doesn't have enough room at the offset * specified. */ public static int putLong(byte[] bytes, int offset, long val) { if ((bytes.length - offset) < SIZEOF_LONG) { throw new IllegalArgumentException((((("Not enough room to put a long at" + " offset ") + offset) + " in a ") + bytes.length) + " byte array"); } return ConverterHolder.BEST_CONVERTER.putLong(bytes, offset, val); }
3.26
hbase_Bytes_compareTo_rdh
/** * Lexicographically compare two arrays. * * @param buffer1 * left operand * @param buffer2 * right operand * @param offset1 * Where to start comparing in the left buffer * @param offset2 * Where to start comparing in the right buffer * @param length1 * How much to compare from the left buffer * @param length2 * How much to compare from the right buffer * @return 0 if equal, < 0 if left is less than right, etc. */ @Override public int compareTo(byte[] buffer1, int offset1, int length1, byte[] buffer2, int offset2, int length2) { // Short circuit equal case if (((buffer1 == buffer2) && (offset1 == offset2)) && (length1 == length2)) { return 0; } final int stride = 8; final int minLength = Math.min(length1, length2); int strideLimit = minLength & (~(stride - 1)); final long offset1Adj = offset1 + UnsafeAccess.BYTE_ARRAY_BASE_OFFSET; final long offset2Adj = offset2 + UnsafeAccess.BYTE_ARRAY_BASE_OFFSET; int i; /* Compare 8 bytes at a time. Benchmarking on x86 shows a stride of 8 bytes is no slower than 4 bytes even on 32-bit. On the other hand, it is substantially faster on 64-bit. */ for (i = 0; i < strideLimit; i += stride) { long lw = HBasePlatformDependent.getLong(buffer1, offset1Adj + i); long rw = HBasePlatformDependent.getLong(buffer2, offset2Adj + i); if (lw != rw) { if (!UnsafeAccess.LITTLE_ENDIAN) { return (lw + Long.MIN_VALUE) < (rw + Long.MIN_VALUE) ? -1 : 1; } /* We want to compare only the first index where left[index] != right[index]. This corresponds to the least significant nonzero byte in lw ^ rw, since lw and rw are little-endian. Long.numberOfTrailingZeros(diff) tells us the least significant nonzero bit, and zeroing out the first three bits of L.nTZ gives us the shift to get that least significant nonzero byte. This comparison logic is based on UnsignedBytes comparator from guava v21 */ int n = Long.numberOfTrailingZeros(lw ^ rw) & (~0x7); return ((int) ((lw >>> n) & 0xff)) - ((int) ((rw >>> n) & 0xff)); }} // The epilogue to cover the last (minLength % stride) elements. for (; i < minLength; i++) { int a = buffer1[offset1 + i] & 0xff; int b = buffer2[offset2 + i] & 0xff; if (a != b) { return a - b; } } return length1 - length2; }
3.26
hbase_Bytes_toByteArrays_rdh
/** * Create a byte[][] where first and only entry is <code>column</code> * * @param column * operand * @return A byte array of a byte array where first and only entry is <code>column</code> */ public static byte[][] toByteArrays(final byte[] column) { byte[][] result = new byte[1][]; result[0] = column; return result; }
3.26
hbase_Bytes_putInt_rdh
/** * Put an int value out to the specified byte array position. * * @param bytes * the byte array * @param offset * position in the array * @param val * int to write out * @return incremented offset * @throws IllegalArgumentException * if the byte array given doesn't have enough room at the offset * specified. */ public static int putInt(byte[] bytes, int offset, int val) { if ((bytes.length - offset) < f0) { throw new IllegalArgumentException((((("Not enough room to put an int at" + " offset ") + offset) + " in a ") + bytes.length) + " byte array"); } return ConverterHolder.BEST_CONVERTER.putInt(bytes, offset, val); }
3.26
hbase_Bytes_putShort_rdh
/** * Put a short value out to the specified byte array position. * * @param bytes * the byte array * @param offset * position in the array * @param val * short to write out * @return incremented offset * @throws IllegalArgumentException * if the byte array given doesn't have enough room at the offset * specified. */ public static int putShort(byte[] bytes, int offset, short val) { if ((bytes.length - offset) < SIZEOF_SHORT) { throw new IllegalArgumentException((((("Not enough room to put a short at" + " offset ") + offset) + " in a ") + bytes.length) + " byte array"); } return ConverterHolder.BEST_CONVERTER.putShort(bytes, offset, val); }
3.26
hbase_Bytes_getOffset_rdh
/** * Return the offset into the buffer. */ public int getOffset() { return this.offset; }
3.26
hbase_Bytes_toBigDecimal_rdh
/** * Converts a byte array to a BigDecimal */ public static BigDecimal toBigDecimal(byte[] bytes) { return m2(bytes, 0, bytes.length); }
3.26
hbase_Bytes_padTail_rdh
/** * Make a new byte array from a subset of bytes at the tail of another, zero padded as desired. * * @param a * array * @param length * new array size * @return Value in <code>a</code> plus <code>length</code> appended 0 bytes */ public static byte[] padTail(final byte[] a, final int length) { byte[] v110 = new byte[length]; for (int i = 0; i < length; i++) { v110[i] = 0; } return add(a, v110); }
3.26
hbase_Bytes_getBestConverter_rdh
/** * Returns the Unsafe-using Converter, or falls back to the pure-Java implementation if unable * to do so. */ static Converter getBestConverter() { try { Class<?> theClass = Class.forName(UNSAFE_CONVERTER_NAME); // yes, UnsafeComparer does implement Comparer<byte[]> @SuppressWarnings("unchecked") Converter converter = ((Converter) (theClass.getConstructor().newInstance()));return converter; } catch (Throwable t) { // ensure we really catch *everything* return PureJavaConverter.INSTANCE; } }
3.26
hbase_Bytes_toHex_rdh
/** * Convert a byte array into a hex string */ public static String toHex(byte[] b) { return toHex(b, 0, b.length); }
3.26
hbase_Bytes_toInt_rdh
/** * Converts a byte array to an int value * * @param bytes * byte array * @param offset * offset into array * @param length * length of int (has to be {@link #SIZEOF_INT}) * @return the int value * @throws IllegalArgumentException * if length is not {@link #SIZEOF_INT} or if there's not enough * room in the array at the offset indicated. */ public static int toInt(byte[] bytes, int offset, final int length) { if ((length != f0) || ((offset + length) > bytes.length)) { throw explainWrongLengthOrOffset(bytes, offset, length, f0); } return ConverterHolder.BEST_CONVERTER.toInt(bytes, offset, length); }
3.26
hbase_Bytes_m0_rdh
/** * Returns a copy of the bytes referred to by this writable */ public byte[] m0() { return Arrays.copyOfRange(bytes, offset, offset + length); }
3.26
hbase_Bytes_split_rdh
/** * Split passed range. Expensive operation relatively. Uses BigInteger math. Useful splitting * ranges for MapReduce jobs. * * @param a * Beginning of range * @param b * End of range * @param inclusive * Whether the end of range is prefix-inclusive or is considered an exclusive * boundary. Automatic splits are generally exclusive and manual splits with an * explicit range utilize an inclusive end of range. * @param num * Number of times to split range. Pass 1 if you want to split the range in two; * i.e. one split. * @return Array of dividing values */ public static byte[][] split(final byte[] a, final byte[] b, boolean inclusive, final int num) { byte[][] ret = new byte[num + 2][]; int i = 0; Iterable<byte[]> iter = iterateOnSplits(a, b, inclusive, num); if (iter == null) return null; for (byte[] elem : iter) { ret[i++] = elem; } return ret; }
3.26
hbase_Bytes_putFloat_rdh
/** * Put a float value out to the specified byte array position. * * @param bytes * byte array * @param offset * offset to write to * @param f * float value * @return New offset in <code>bytes</code> */ public static int putFloat(byte[] bytes, int offset, float f) { return putInt(bytes, offset, Float.floatToRawIntBits(f)); }
3.26
hbase_Bytes_putByteBuffer_rdh
/** * Add the whole content of the ByteBuffer to the bytes arrays. The ByteBuffer is modified. * * @param bytes * the byte array * @param offset * position in the array * @param buf * ByteBuffer to write out * @return incremented offset */ public static int putByteBuffer(byte[] bytes, int offset, ByteBuffer buf) { int len = buf.remaining(); buf.get(bytes, offset, len); return offset + len; }
3.26
hbase_Bytes_putBigDecimal_rdh
/** * Put a BigDecimal value out to the specified byte array position. * * @param bytes * the byte array * @param offset * position in the array * @param val * BigDecimal to write out * @return incremented offset */ public static int putBigDecimal(byte[] bytes, int offset, BigDecimal val) { if (bytes == null) { return offset; } byte[] valueBytes = val.unscaledValue().toByteArray();byte[] result = new byte[valueBytes.length + f0]; offset = putInt(result, offset, val.scale()); return putBytes(result, offset, valueBytes, 0, valueBytes.length); }
3.26
hbase_ConfServlet_writeResponse_rdh
/** * Guts of the servlet - extracted for easy testing. */ static void writeResponse(Configuration conf, Writer out, String format) throws IOException, BadFormatException { Configuration maskedConf = m0(conf); if (FORMAT_JSON.equals(format)) { Configuration.dumpConfiguration(maskedConf, out); } else if (FORMAT_XML.equals(format)) { maskedConf.writeXml(out); } else { throw new BadFormatException("Bad format: " + format); } }
3.26
hbase_ConfServlet_getConfFromContext_rdh
/** * Return the Configuration of the daemon hosting this servlet. This is populated when the * HttpServer starts. */ private Configuration getConfFromContext() { Configuration conf = ((Configuration) (getServletContext().getAttribute(HttpServer.CONF_CONTEXT_ATTRIBUTE))); assert conf != null; return conf; }
3.26
hbase_ExampleMasterObserverWithMetrics_getMaxMemory_rdh
/** * Returns the max memory of the process. We will use this to define a gauge metric */ private long getMaxMemory() { return Runtime.getRuntime().maxMemory(); }
3.26
hbase_ExampleMasterObserverWithMetrics_getTotalMemory_rdh
/** * Returns the total memory of the process. We will use this to define a gauge metric */ private long getTotalMemory() { return Runtime.getRuntime().totalMemory(); }
3.26
hbase_BufferChain_getBytes_rdh
/** * Expensive. Makes a new buffer to hold a copy of what is in contained ByteBuffers. This call * drains this instance; it cannot be used subsequent to the call. * * @return A new byte buffer with the content of all contained ByteBuffers. */byte[] getBytes() { if (!hasRemaining()) throw new IllegalAccessError(); byte[] bytes = new byte[this.remaining]; int offset = 0; for (ByteBuffer bb : this.buffers) { int length = bb.remaining(); bb.get(bytes, offset, length); offset += length; } return bytes; }
3.26