List of usage examples for java.util Locale ROOT
Locale ROOT
To view the source code for java.util Locale ROOT.
Click Source Link
From source file:io.syndesis.filestore.impl.SqlFileStore.java
private String newRandomTempFilePath() { SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd-HH-mm", Locale.ROOT); return "/tmp/" + fmt.format(new Date()) + "_" + UUID.randomUUID(); }
From source file:com.shvet.poi.util.HexDump.java
private static String xpad(long value, int pad, String prefix) { String sv = Long.toHexString(value).toUpperCase(Locale.ROOT); int len = sv.length(); if ((pad == 0 || len == pad) && "".equals(prefix)) return sv; StringBuilder sb = new StringBuilder(prefix); if (len < pad) { sb.append("0000000000000000", 0, pad - len); sb.append(sv);/* w w w . j a v a 2s . c o m*/ } else if (len > pad) { sb.append(sv, len - pad, len); } else { sb.append(sv); } return sb.toString(); }
From source file:business.security.control.OwmClient.java
/** * Find current city weather/*from w ww . ja va 2 s . com*/ * * @param cityName is the name of the city * @throws JSONException if the response from the OWM server can't be parsed * @throws IOException if there's some network error or the OWM server * replies with a error. */ public WeatherStatusResponse currentWeatherAtCity(String cityName) throws IOException, JSONException { String subUrl = String.format(Locale.ROOT, "find/name?q=%s", cityName); JSONObject response = doQuery(subUrl); return new WeatherStatusResponse(response); }
From source file:edu.ncsa.sstde.indexing.postgis.PostgisIndexerSettings.java
private void validateAndInitLanguagesForPartition(PartitionDef pd) { Set<String> languages = new HashSet<String>(); if (pd.getLanguagePartitions() != null) for (String l : pd.getLanguagePartitions()) { String lang = l.toLowerCase(Locale.ROOT); if (lang.isEmpty()) throw new IllegalStateException("Invalid partition: empty language"); else if (!languages.add(lang)) throw new IllegalStateException("Overlapping partition for predicate: " + lang); for (String predicate : pd.getPredicates()) partitionNames.get(predicate).put(lang, getTableName(getPartitionName(pd, lang))); }/* w w w . ja va 2s .c o m*/ }
From source file:com.gargoylesoftware.htmlunit.html.HtmlArea.java
private boolean isEmpty() { final String shape = StringUtils.defaultIfEmpty(getShapeAttribute(), "rect").toLowerCase(Locale.ROOT); if ("default".equals(shape) && getCoordsAttribute() != null) { return false; }// ww w . j av a 2 s . c om if ("rect".equals(shape) && getCoordsAttribute() != null) { final Rectangle2D rectangle = parseRect(); return rectangle.isEmpty(); } if ("circle".equals(shape) && getCoordsAttribute() != null) { final Ellipse2D ellipse = parseCircle(); return ellipse.isEmpty(); } if ("poly".equals(shape) && getCoordsAttribute() != null) { return false; } return false; }
From source file:com.digitalpebble.stormcrawler.filtering.basic.BasicURLNormalizer.java
/** * Convert path segment of URL from Unicode to UTF-8 and escape all * characters which should be escaped according to <a * href="https://tools.ietf.org/html/rfc3986#section-2.2">RFC3986</a>.. *//* w w w .j a v a2 s .c o m*/ private String escapePath(String path) { StringBuilder sb = new StringBuilder(path.length()); // Traverse over all bytes in this URL for (byte b : path.getBytes(utf8)) { // Is this a control character? if (b < 33 || b == 91 || b == 93 || b == 124) { // Start escape sequence sb.append('%'); // Get this byte's hexadecimal representation String hex = Integer.toHexString(b & 0xFF).toUpperCase(Locale.ROOT); // Do we need to prepend a zero? if (hex.length() % 2 != 0) { sb.append('0'); sb.append(hex); } else { // No, append this hexadecimal representation sb.append(hex); } } else { // No, just append this character as-is sb.append((char) b); } } return sb.toString(); }
From source file:com.facebook.share.ShareApi.java
private static void putImageInBundleWithArrayFormat(Bundle parameters, int index, JSONObject image) throws JSONException { Iterator<String> keys = image.keys(); while (keys.hasNext()) { String property = keys.next(); String key = String.format(Locale.ROOT, "image[%d][%s]", index, property); parameters.putString(key, image.get(property).toString()); }/* www . jav a 2s.c om*/ }
From source file:net.radai.beanz.util.ReflectionUtil.java
public static Method findSetter(Class<?> clazz, String propName) { String expectedName = "set" + propName.substring(0, 1).toUpperCase(Locale.ROOT) + propName.substring(1); for (Method method : clazz.getMethods()) { if (!method.getName().equals(expectedName)) { continue; }//from ww w .j ava 2s .c o m if (!method.getReturnType().equals(void.class)) { continue; } Type[] argTypes = method.getGenericParameterTypes(); if (argTypes == null || argTypes.length != 1) { continue; } return method; } return null; }
From source file:io.syndesis.filestore.impl.SqlFileStore.java
private boolean tableExists(Handle h, String tableName) { try {//from w w w. j av a2s. c om String tableToCheck = tableName; boolean caseSensitive = this.databaseKind == DatabaseKind.PostgreSQL; if (!caseSensitive) { tableToCheck = tableName.toUpperCase(Locale.ROOT); } DatabaseMetaData metaData = h.getConnection().getMetaData(); try (ResultSet rs = metaData.getTables(null, null, tableToCheck, null)) { while (rs.next()) { String foundTable = rs.getString("TABLE_NAME"); if (tableToCheck.equalsIgnoreCase(foundTable)) { return true; } } } return false; } catch (SQLException ex) { throw FileStoreException.launderThrowable("Cannot check if the table " + tableName + " already exists", ex); } }
From source file:com.gargoylesoftware.htmlunit.html.HtmlElement.java
/** * Returns the HTML elements that are descendants of this element and that have the specified tag name. * @param tagName the tag name to match (case-insensitive) * @param <E> the sub-element type * @return the HTML elements that are descendants of this element and that have the specified tag name *//* w w w . j a va2 s . co m*/ @SuppressWarnings("unchecked") public final <E extends HtmlElement> List<E> getHtmlElementsByTagName(final String tagName) { final List<E> list = new ArrayList<>(); final String lowerCaseTagName = tagName.toLowerCase(Locale.ROOT); final Iterable<HtmlElement> iterable = getHtmlElementDescendants(); for (final HtmlElement element : iterable) { if (lowerCaseTagName.equals(element.getTagName())) { list.add((E) element); } } return list; }