/** * Wrapper of {@link String#intern()} * * @return the intern of the string */ @Override public String intern() { return toString().intern(); }
/** * Wrapper of {@link String#intern()} * * @return the intern of the string */ @Override public String intern() { return toString().intern(); }
public List<String> tokens() { List<String> list = new ArrayList<String>(); for (FastStr fs : this.list) { list.add(fs.toString()); } return list; }
/** * Wrapper of {@link String#toLowerCase(java.util.Locale)} but return FastStr type instance * * @param locale the locale * @return a FastStr instance with all characters from this FastStr * be converted into lowercase based on the locale specified */ public FastStr toLowerCase(Locale locale) { String s = toString(); return unsafeOf(s.toLowerCase(locale)); }
/** * Wrapper of {@link String#toLowerCase(java.util.Locale)} but return FastStr type instance * * @param locale the locale * @return a FastStr instance with all characters from this FastStr * be converted into lowercase based on the locale specified */ public FastStr toLowerCase(Locale locale) { String s = toString(); return unsafeOf(s.toLowerCase(locale)); }
private String val(Map<String, String> conf, String key, String prefix) { String val = conf.get(key); if (S.blank(val)) { if (key.startsWith("storage.")) { key = FastStr.of(key).insert(8, prefix).toString(); } val = conf.get(key); } return val; }
public static File sourceFile(List<File> sourceRoots, String className) { FastStr s = FastStr.of(className).beforeFirst('$'); s = s.replace('.', File.separatorChar).append(".java"); for (File sourceRoot : sourceRoots) { File file = new File(sourceRoot, s.toString()); if (file.canRead()) { return file; } } return null; }
public static H.Format contentType(String path) { H.Format retVal = null; if (path.contains(".")) { FastStr s = FastStr.unsafeOf(path).afterLast('.'); retVal = H.Format.of(s.toString()); } return null == retVal ? H.Format.BINARY : retVal; }
public static H.Format contentType(String path) { H.Format retVal = null; if (path.contains(".")) { FastStr s = FastStr.unsafeOf(path).afterLast('.'); retVal = H.Format.of(s.toString()); } return null == retVal ? H.Format.BINARY : retVal; }
public static File sourceFile(List<File> sourceRoots, String className) { FastStr s = FastStr.of(className).beforeFirst('$'); s = s.replace('.', File.separatorChar).append(".java"); for (File sourceRoot : sourceRoots) { File file = new File(sourceRoot, s.toString()); if (file.canRead()) { return file; } } return null; }
public FastStr encodeBASE64() { String s; try { s = Unsafe.stringOf(buf); } catch (Exception e) { s = toString(); } return unsafeOf(S.encodeBASE64(s)); }
public FastStr urlEncode() { String s; try { s = Unsafe.stringOf(buf); } catch (Exception e) { s = toString(); } return unsafeOf(S.urlEncode(s)); }
public static String classNameToClassFileName(String className, boolean keepInnerClass) { FastStr fs = FastStr.of(className); if (!keepInnerClass && className.contains("$")) { fs = fs.beforeFirst('$'); } fs = fs.replace('.', '/').append(".class").prepend('/'); return fs.toString(); }
public static String classNameToClassFileName(String className, boolean keepInnerClass) { FastStr fs = FastStr.of(className); if (!keepInnerClass && className.contains("$")) { fs = fs.beforeFirst('$'); } fs = fs.replace('.', '/').append(".class").prepend('/'); return fs.toString(); }
protected T targetVersion(JavaVersion version) { targetVersion = FastStr.of(version.name()).substr(1).replace('_', '.').toString(); return me(); }
protected T sourceVersion(JavaVersion version) { sourceVersion = FastStr.of(version.name()).substr(1).replace('_', '.').toString(); return me(); }
static void hashCodeMethodEnd(MethodVisitor mv, int fieldCnt) { FastStr signature; if (fieldCnt < 6) { signature = FastStr.of("Ljava/lang/Object;").times(fieldCnt); } else { signature = FastStr.of("Ljava/lang/Object;").times(5).append("[Ljava/lang/Object;"); } signature = signature.prepend("(").append(")I"); mv.visitMethodInsn(INVOKESTATIC, "org/osgl/Osgl", "hc", signature.toString(), false); mv.visitInsn(IRETURN); mv.visitMaxs(0, 0); // just pass any number and have ASM to calculate mv.visitEnd(); }
static void hashCodeMethodEnd(MethodVisitor mv, int fieldCnt) { FastStr signature; if (fieldCnt < 6) { signature = FastStr.of("Ljava/lang/Object;").times(fieldCnt); } else { signature = FastStr.of("Ljava/lang/Object;").times(5).append("[Ljava/lang/Object;"); } signature = signature.prepend("(").append(")I"); mv.visitMethodInsn(INVOKESTATIC, "org/osgl/Osgl", "hc", signature.toString(), false); mv.visitInsn(IRETURN); mv.visitMaxs(0, 0); // just pass any number and have ASM to calculate mv.visitEnd(); }