Example usage for java.util Locale ENGLISH

List of usage examples for java.util Locale ENGLISH

Introduction

In this page you can find the example usage for java.util Locale ENGLISH.

Prototype

Locale ENGLISH

To view the source code for java.util Locale ENGLISH.

Click Source Link

Document

Useful constant for language.

Usage

From source file:pl.bristleback.server.bristle.serialization.jackson.JacksonSerializationPerformanceTest.java

@Test
public void serializeRawSimpleValue() throws Exception {
    Locale.setDefault(Locale.ENGLISH);
    long deserializedForm = 332221L;
    Object serialization = getSerialization("rawLong");

    measurePerformance(deserializedForm, serialization, "Long raw value");
}

From source file:fr.treeptik.cloudunit.utils.CheckUtils.java

/**
 * Valid a field input with a max size//from   ww w. jav a  2  s  .co m
 *
 * @param field
 * @param message
 * @param size
 * @throws CheckException
 */
public static void validateInputSizeMax(String field, String message, int size) throws CheckException {
    if (field == null || field.trim().length() == 0 || "undefined".equals(field) || field.length() > size) {
        String messageTranslated = messageSource.getMessage(message, null, Locale.ENGLISH);
        throw new CheckException(messageTranslated + " : " + field);
    }
}

From source file:de.devbliss.apitester.ApiRequest.java

/**
 * Get the header value with the given name
 * /*from   ww  w  .ja  v a2  s  .  c o  m*/
 * @param name The name of the header. As per the RFC, header names are case
 *            insensitive
 * @return The value, or null if no header with that name was found
 */
public String getHeader(String name) {
    return headers.get(name.toLowerCase(Locale.ENGLISH));
}

From source file:ca.nines.ise.cmd.Chars.java

/**
 * {@inheritDoc}/*w ww. j  a va  2  s . c o  m*/
 */
@Override
public void execute(CommandLine cmd) throws Exception {
    File[] files;
    Locale.setDefault(Locale.ENGLISH);
    PrintStream out = new PrintStream(System.out, true, "UTF-8");

    if (cmd.hasOption("l")) {
        out = new PrintStream(new FileOutputStream(cmd.getOptionValue("l")), true, "UTF-8");
    }

    Map<String, Integer> m = new HashMap<>();
    Map<CharType, HashMap<String, Integer>> types = new HashMap<>();
    files = getFilePaths(cmd);

    for (CharType type : CharType.values()) {
        types.put(type, new HashMap<String, Integer>());
    }

    out.println("Found " + files.length + " files to check.");
    for (File file : files) {
        DOM dom = new DOMBuilder(file).build();
        for (Node n : dom) {
            if (n instanceof CharNode) {
                CharNode c = (CharNode) n;
                m.put(n.getText(), 1);
                types.get(c.getCharType()).put(c.getText(), 1);
            }
        }
    }

    out.println("EXISTING CHARS BY TYPE:");
    for (CharType type : CharType.values()) {
        out.println(type.name());
        for (String str : types.get(type).keySet()) {
            out.println(str);
        }
    }

    out.println("EXISTING CHARS: ");
    for (String k : m.keySet()) {
        out.println(k);
    }
}

From source file:com.microsoftopentechnologies.windowsazurestorage.helper.Utils.java

/**
 * Checks for validity of container name after converting the input into
 * lowercase. Rules for container name 1.Container names must start with a
 * letter or number, and can contain only letters, numbers, and the dash (-)
 * character. 2.Every dash (-) character must be immediately preceded and
 * followed by a letter or number; consecutive dashes are not permitted in
 * container names. 3.All letters in a container name must be lowercase.
 * 4.Container names must be from 3 through 63 characters long.
 *
 * @param containerName Name of the Windows Azure storage container
 * @return true if container name is valid else returns false
 *///from w  w  w  .j a  va2  s.c  o m
public static boolean validateContainerName(final String containerName) {
    if (containerName != null) {
        String lcContainerName = containerName.trim().toLowerCase(Locale.ENGLISH);
        if (lcContainerName.matches(Constants.VAL_CNT_NAME)) {
            return true;
        }
    }
    return false;
}

From source file:nz.net.orcon.kanban.automation.plugin.FreemarkerPlugin.java

@Override
public Map<String, Object> process(Action action, Map<String, Object> context) throws Exception {
    String resource = getResourceController().getResource((String) context.get("boardid"),
            action.getResource());//from  ww  w.j  ava2s  . com

    Configuration configuration = new Configuration();

    configuration.setEncoding(Locale.ENGLISH, "UTF-8");

    Template template = new Template(action.getResource(), new StringReader(resource), configuration);
    Writer output = new StringWriter();
    template.process(context, output);
    String result = output.toString();
    context.put(action.getResponse(), result);
    return context;
}

From source file:ru.jts_dev.gameserver.parser.html.HtmlRepositoryTest.java

@Test
public void testGetHtml() throws Exception {
    String content = htmlRepository.getHtml(Locale.ENGLISH, "abel001.htm");
    assertThat(content).hasSize(512);/* w w  w .  j  a  va2s . c om*/

    content = htmlRepository.getHtml(Locale.ENGLISH, "abel002.htm");
    assertThat(content).hasSize(367);
}

From source file:ca.nines.ise.cmd.Syntax.java

/**
 * {@inheritDoc}/*w  w w.j  a  v  a2s. c  o  m*/
 */
@Override
public void execute(CommandLine cmd) throws Exception {
    File[] files;

    Log log = Log.getInstance();
    Locale.setDefault(Locale.ENGLISH);
    PrintStream out = new PrintStream(System.out, true, "UTF-8");

    if (cmd.hasOption("l")) {
        out = new PrintStream(new FileOutputStream(cmd.getOptionValue("l")), true, "UTF-8");
    }

    files = getFilePaths(cmd);
    out.println("Found " + files.length + " files to check.");
    for (File file : files) {
        DOM dom = new DOMBuilder(file).build();
        if (log.count() > 0) {
            out.println(log);
            log.clear();
        }
    }
}

From source file:ca.nines.ise.cmd.Renumber.java

@Override
public void execute(CommandLine cmd) throws Exception {
    PrintStream outputStream;//from w  w w  .j a  v  a2  s . c  om
    Locale.setDefault(Locale.ENGLISH);
    outputStream = new PrintStream(System.out, true, "UTF-8");
    if (cmd.hasOption("o")) {
        outputStream = new PrintStream(new FileOutputStream(cmd.getOptionValue("o")), true, "UTF-8");
    }

    String[] files = getArgList(cmd);
    if (files.length > 1) {
        System.err.println("Can only renumber one file at a time.");
        help();
        System.exit(1);
    }
    DOM dom = new DOMBuilder(new File(files[0])).build();
    if (dom.getStatus() != DOMStatus.ERROR) {
        Renumberer r = new Renumberer();
        if (cmd.hasOption("l")) {
            r.setRenumberLine(true);
        }
        if (cmd.hasOption("qln")) {
            r.setRenumberQln(true);
        }
        if (cmd.hasOption("tln")) {
            r.setRenumberTln(true);
        }
        if (cmd.hasOption("wln")) {
            r.setRenumberWln(true);
        }
        if (cmd.hasOption("act")) {
            r.setRenumberAct(true);
        }
        if (cmd.hasOption("scene")) {
            r.setRenumberScene(true);
        }
        if (cmd.hasOption("stanza")) {
            r.setRenumberStanza(true);
        }
        if (cmd.hasOption("page")) {
            r.setRenumberPage(true);
        }

        dom = r.transform(dom);

    }
    Writer out = new SGMLWriter(outputStream);
    out.render(dom);
}

From source file:Main.java

/**
 * according station to get frequency string
 * @param station for 100KZ, range 875-1080, for 50khz 8750,1080
 * @return string like 87.5 or 87.50//from  w w w  .  j a va2 s.  c  om
 */
public static String formatStation(int station) {
    float frequency = (float) station / CONVERT_RATE;
    String result = null;
    if (false/*FeatureOption.MTK_FM_50KHZ_SUPPORT*/) {
        result = String.format(Locale.ENGLISH, "%.2f", Float.valueOf(frequency));
    } else {
        result = String.format(Locale.ENGLISH, "%.1f", Float.valueOf(frequency));
    }
    return result;
}