lib/src/main/java/io/v/v23/syncbase/util/Util.java
/**
     * Returns the limit of the row range for the given prefix.
     */
Returns the limit of the row range for the given prefix.
Returns the limit of the row range for the given prefix .
public static String prefixRangeLimit(String prefix) {
        try {
            byte[] bytes = prefix.getBytes("ISO8859-1");
            int last = bytes.length - 1;
            for (; last >= 0 && bytes[last] == (byte) 0xFF; --last) ;
            if (last < 0) {
                return "";
            }
            bytes[last] += 1;
            return new String(bytes, 0, last + 1, "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException("JVM must support ISO8859-1 char encoding", e);
        }
    }
public static String prefixRangeLimit ( String prefix ) { try { byte [ ] bytes = prefix . getBytes ( "ISO8859-1" ) ; int last = bytes . length - 1 ; for ( ; last >= 0 && bytes [ last ] == ( byte ) 0xFF ; -- last ) ; if ( last < 0 ) { return "" ; } bytes [ last ] += 1 ; return new String ( bytes , 0 , last + 1 , "ISO8859-1" ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( "JVM must support ISO8859-1 char encoding" , e ) ; } }
Returns the limit of the row range for the given prefix.
Returns the limit of the row range for the given prefix .
// We convert a string to a byte[] array, which can be thought of as a base-256 // number.  The code below effectively adds 1 to this number, then chops off any // trailing 0x00 bytes. If the input string consists entirely of 0xFF, an empty string // will be returned.