congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
StringReflection
Code IndexAdd Tabnine to your IDE (free)

How to use
StringReflection
in
com.wizzardo.tools.reflection

Best Java code snippets using com.wizzardo.tools.reflection.StringReflection (Showing top 14 results out of 315)

origin: com.wizzardo.tools/tools-misc

public void write(String s, int off, int l) throws IOException {
  int offset = StringReflection.offset(s) + off;
  char[] chars = StringReflection.chars(s);
  write(chars, offset, l);
}
origin: wizzardo/http

public static String read(byte[] buffer, int bufferLength, byte[] bytes, int offset, int length) {
  char[] data = new char[bufferLength + length];
  int h = 0;
  int k;
  for (int i = 0; i < bufferLength; i++) {
    data[i] = (char) (k = (buffer[i] & 0xff));
    h = 31 * h + k;
  }
  for (int i = 0; i < length; i++) {
    data[i + bufferLength] = (char) (k = (bytes[offset + i] & 0xff));
    h = 31 * h + k;
  }
  return StringReflection.createString(data, h);
}
origin: wizzardo/http

  public static int write(String s, byte[] bytes, int offset) {
    char[] chars = StringReflection.chars(s);
    int l = chars.length + offset;
    for (int i = offset; i < l; i++) {
      bytes[i] = (byte) chars[i - offset];
    }
    return l;
  }
}
origin: wizzardo/http

public static int encodeWithCompression(String s, byte[] bytes, int offsetBits) {
  if (offsetBits % 8 != 0)
    return -1;
  int index = offsetBits >> 3;
  int l = s.length();
  if (l <= 160) { //average compressed length for one byte
    int offset = StaticHttp2HuffmanTable.huffman.encode(bytes, (offsetBits + 8) >> 3, StringReflection.chars(s));
    int k = 8 - offset + ((offset >> 3) << 3);
    if (k != 8) {
      bytes[offset >> 3] = (byte) (bytes[offset >> 3] | (1 << k) - 1);
      offset += k;
    }
    if ((offset >> 3) > 127) {
      //todo: shift data
    }
    bytes[index] = (byte) 128;
    encode((offset - offsetBits - 8) >> 3, bytes, offsetBits + 1);
    return offset;
  } else {
    //todo: calculate optimal size and encode
  }
  return offsetBits;
}
origin: wizzardo/tools

public void write(String s, int off, int l) throws IOException {
  int offset = StringReflection.offset(s) + off;
  char[] chars = StringReflection.chars(s);
  write(chars, offset, l);
}
origin: wizzardo/http

private void parse(String auth) {
  char[] chars = StringReflection.chars(auth);
  int i = 7;
  int length = chars.length;
origin: wizzardo/http

  public static String read(byte[] bytes, int offset, int length, int hash) {
//            return read(bytes, offset, length);
    if (length <= 0)
      return new String();

    char[] data = new char[length];
    for (int i = 0; i < length; i++) {
      data[i] = (char) (bytes[offset + i] & 0xff);
    }

    return StringReflection.createString(data, hash);
  }

origin: wizzardo/tools

public static <T> T parse(String s, JsonGeneric<T> generic) {
  s = s.trim();
  char[] data = StringReflection.chars(s);
  int offset = 0;
  if (data.length != s.length())
    offset = StringReflection.offset(s); // for java 6
  return parse(data, offset, offset + s.length(), generic);
}
origin: wizzardo/http

public static String read(byte[] bytes, int offset, int length) {
  if (length <= 0)
    return new String();
  int h = 0;
  int k;
  char[] data = new char[length];
  for (int i = 0; i < length; i++) {
    data[i] = (char) (k = (bytes[offset + i] & 0xff));
    h = 31 * h + k;
  }
  return StringReflection.createString(data, h);
}
origin: wizzardo/tools

static void escape(String s, Appender sb) {
  char[] chars = StringReflection.chars(s);
  int to = s.length();
  int offset = chars.length == to ? 0 : StringReflection.offset(s);
  int from = offset;
  to += from;
  int l = to - 1;
  for (int i = from; i < l; i += 2) {
    from = check(from, i, chars, sb);
    from = check(from, i + 1, chars, sb);  //about 10% faster
  }
  if ((l + offset) % 2 == 0)
    from = check(from, l, chars, sb);
  if (from < to)
    append(chars, from, to, sb);
}
origin: wizzardo/tools

public static String format(Date date, TimeZone timeZone) {
  return StringReflection.createString(formatToChars(date, timeZone));
}
origin: wizzardo/tools

try {
  int length = s.length();
  char[] chars = StringReflection.chars(s);
  int i = length == chars.length ? 0 : StringReflection.offset(s);
  int year, month, day;
  year = getInt4(chars, i);
origin: com.wizzardo.tools/tools-misc

public static String format(Date date, TimeZone timeZone) {
  return StringReflection.createString(formatToChars(date, timeZone));
}
origin: com.wizzardo.tools/tools-misc

try {
  int length = s.length();
  char[] chars = StringReflection.chars(s);
  int i = length == chars.length ? 0 : StringReflection.offset(s);
  int year, month, day;
  year = getInt4(chars, i);
com.wizzardo.tools.reflectionStringReflection

Most used methods

  • chars
  • createString
  • offset

Popular in Java

  • Reading from database using SQL prepared statement
  • getSupportFragmentManager (FragmentActivity)
  • getSharedPreferences (Context)
  • getExternalFilesDir (Context)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • String (java.lang)
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now