List of usage examples for java.lang String toUpperCase
public String toUpperCase()
From source file:com.mxep.web.web.Servlets.java
/** * ??Header.//from w ww . j av a 2 s. c o m * * @param fileName ???. */ public static void setFileDownloadHeader(HttpServletRequest request, HttpServletResponse response, String fileName) { // ??? String encodedfileName = null; // ??firefox??,???+? encodedfileName = fileName.trim().replaceAll(" ", "_"); String agent = request.getHeader("User-Agent"); boolean isMSIE = (agent != null && agent.toUpperCase().indexOf("MSIE") != -1); if (isMSIE) { encodedfileName = EncodeUtils.urlEncode(fileName); } else { encodedfileName = new String(fileName.getBytes(), Charsets.ISO_8859_1); } response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + encodedfileName + "\""); }
From source file:th.co.geniustree.dental.spec.StaffSpec.java
public static Specification<Staff> emailLike(final String keyword) { return new Specification<Staff>() { @Override//from w w w . j ava 2 s.c o m public Predicate toPredicate(Root<Staff> root, CriteriaQuery<?> cq, CriteriaBuilder cb) { return cb.like(cb.upper(root.get(Staff_.email)), keyword.toUpperCase()); } }; }
From source file:com.googlecode.jsendnsca.NagiosSettingsFactory.java
private static Encryption toEncryption(String value) throws NagiosConfigurationException { try {/*w ww . j a v a 2 s .c om*/ return Encryption.valueOf(Encryption.class, value.toUpperCase()); } catch (IllegalArgumentException e) { throw new NagiosConfigurationException("Key [%s] must be one of [%s], was [foobar]", PropertyKey.ENCRYPTION.name, Encryption.supportedList().toLowerCase(), value); } }
From source file:Main.java
public static String byte2hex(byte[] b) { String hs = ""; String stmp = ""; for (int n = 0; n < b.length; n++) { stmp = (Integer.toHexString(b[n] & 0XFF)); if (stmp.length() == 1) { hs = hs + "0" + stmp; } else {/*from www . j a v a 2s.c o m*/ hs = hs + stmp; } } return hs.toUpperCase(); }
From source file:com.mirth.connect.util.TcpUtil.java
public static byte[] stringToByteArray(String str) { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); if (StringUtils.isNotBlank(str)) { String hexString = str.toUpperCase().replaceAll("[^0-9A-F]", ""); for (String hexByte : ((hexString.length() % 2 > 0 ? "0" : "") + hexString).split("(?<=\\G..)")) { bytes.write((byte) ((Character.digit(hexByte.charAt(0), 16) << 4) + Character.digit(hexByte.charAt(1), 16))); }//from ww w. j av a2 s.co m } return bytes.toByteArray(); }
From source file:com.blacklocus.jres.http.HttpMethods.java
/** * @param method http method, case-insensitive * @param url destination of request * @param payload (optional) request body. An InputStream or String will be sent as is, while any other type will * be serialized with {@link ObjectMappers#NORMAL} to JSON. * @return HttpUriRequest with header <code>Accept: application/json; charset=UTF-8</code> *//*from w w w . j a v a 2 s . c o m*/ public static HttpUriRequest createRequest(String method, String url, final Object payload) { LOG.debug("{} {}", method, url); HttpUriRequest httpUriRequest = METHODS.get(method.toUpperCase()).newMethod(url); httpUriRequest.addHeader("Accept", ContentType.APPLICATION_JSON.toString()); if (payload != null) { try { // This cast will except if a body is given for non-HttpEntityEnclosingRequest types. Deal with it later. ((HttpEntityEnclosingRequest) httpUriRequest).setEntity(createEntity(payload)); } catch (IOException e) { throw new RuntimeException(e); } } return httpUriRequest; }
From source file:Main.java
/** * DCL2 Adjust the name of the class to make the identification easier It is * done by converting all "/" to "."// w w w .ja v a 2 s . com * * Still "converts" the primitive types to your Wrapper. * * @param className * Name of the class * @return Adjusted class name */ public static String adjustClassName(String className) { if (className.startsWith("boolean") || className.startsWith("byte") || className.startsWith("short") || className.startsWith("long") || className.startsWith("double") || className.startsWith("float")) { return "java.lang." + className.toUpperCase().substring(0, 1) + className.substring(1); } else if (className.startsWith("int")) { return "java.lang.Integer"; } else if (className.startsWith("int[]")) { return "java.lang.Integer[]"; } else if (className.startsWith("char")) { return "java.lang.Character"; } else if (className.startsWith("char[]")) { return "java.lang.Character[]"; } return className.replaceAll("/", "."); }
From source file:com.baifendian.swordfish.execserver.engine.hive.HiveUtil.java
/** * ? DDL ?, create table /*ww w .ja v a 2 s. co m*/ */ public static boolean isTokDDL(String sql) { if (org.apache.commons.lang3.StringUtils.isEmpty(sql)) { return false; } String tmp = sql.toUpperCase(); if (tmp.startsWith("CREATE") || tmp.startsWith("DROP") || tmp.startsWith("ALTER")) { return true; } return false; }
From source file:controllers.SvnApp.java
private static Result sendResponse(String requestMethod, int statusCode, PipedInputStream input) { if (statusCode < 200 || statusCode == 204 || statusCode == 304 || requestMethod.toUpperCase().equals("HEAD")) { // a response requested by HEAD method and/or whose status code is // 1xx, 204 or 304 MUST NOT include message body. return status(statusCode); } else if (statusCode == 205) { // 205 MUST include message body of zero length. return status(statusCode, ""); } else {/*from w w w.java 2 s . c o m*/ return status(statusCode, input); } }
From source file:ca.uhn.hl7v2.sourcegen.SourceGenerator.java
/** * Bracketed text in a field description should be included in the accessor * name unless it corresponds to a data type name. Given the text that appears in * brackets in a field description, this method returns an empty string if it * corresponds to a data type name, or returns original text if not. It isn't * convenient to actually check (e.g. with DataTypeGenerator) whether the given * text actually corresponds to a data type name, so we are going to conclude that * it is a data type if and only if it is all caps and has 2 or 3 characters. *///from w ww . j a v a 2s .c om private static String filterBracketedText(String text) { String filtered = ""; boolean isDataType = true; if (!text.equals(text.toUpperCase())) isDataType = false; if (text.length() < 2 || text.length() > 3) isDataType = false; if (!isDataType) filtered = text; return filtered; }