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...
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.cac...
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 t...
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...
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.getBlock...
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 ...
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 (atomicIn...
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 shou...
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 conn...
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 ...
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())) { ...
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 ...
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 enou...
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 += ...
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)) + ") int...
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"); } in...
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 ...
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 = (...
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 ri...
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) { ...
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 * @p...
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)...
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.arrayco...
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...
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 = buffe...
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()...
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 =...
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 o...
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[] v...
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(ByteBuff...
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. * ...
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)) &&...
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 h...
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 (le...
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") ...
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.le...
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 ...
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 =...
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.l...
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 re...
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) {...
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, resul...
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...
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]...
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, off...
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...
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 nul...
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) { r...
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[] res...
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')))...
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(f...
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...
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 * ...
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); ...
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...
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, in...
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 put...
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 ...
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 ...
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; retu...
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 ...
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 offse...
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...
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 conver...
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 * ...
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. Automati...
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, Flo...
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, ByteBu...
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 =...
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 (FORM...
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 co...
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()...
3.26