Codota Logo
StringReflection
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
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

  • Running tasks concurrently on multiple threads
  • startActivity (Activity)
  • orElseThrow (Optional)
  • getSystemService (Context)
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • Table (org.hibernate.mapping)
    A relational table
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now