Example usage for java.util Locale US

List of usage examples for java.util Locale US

Introduction

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

Prototype

Locale US

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

Click Source Link

Document

Useful constant for country.

Usage

From source file:com.netflix.imfutility.itunes.asset.SourceAssetProcessorTest.java

@Test
public void testCorrectSource() throws Exception {
    SourceAssetProcessor processor = new SourceAssetProcessor(metadataXmlProvider,
            TemplateParameterContextCreator.getWorkingDir());

    processor.setLocale(Locale.US).process(TestUtils.getTestFile());

    Asset sourceAsset = metadataXmlProvider.getRootElement().getAssets().get(0);
    assertEquals(AssetType.FULL, sourceAsset.getType());
    assertEquals(AssetRole.SOURCE, sourceAsset.getRole());
    assertEquals(Locale.US, sourceAsset.getLocale());
    assertEquals("test-file", sourceAsset.getFileName());
}

From source file:com.compomics.colims.core.io.headers.ProteinGroupHeaders.java

/**
 * Parse a TSV file and create a map for each line that maps the keys found on the first line to the values found to
 * the values found on lines two and further until the end of the file.
 *
 * @param tsvFile tab separated values file
 * @throws IOException// w ww  . ja  v a2s .  com
 */
private void readFileHeaders(final File tsvFile) throws IOException {
    headersInProteinGroupFile = new ArrayList<>();
    fileReader = new FileReader(tsvFile);
    lineReader = new LineReader(fileReader);

    String firstLine = lineReader.readLine();

    if (firstLine == null || firstLine.isEmpty()) {
        throw new IOException("Input file " + tsvFile.getPath() + " is empty.");
    } else {
        String[] headers = firstLine.toLowerCase(Locale.US).split("" + DELIMITER);
        Arrays.stream(headers).forEach(e -> headersInProteinGroupFile.add(e));
    }
}

From source file:com.payu.sdk.helper.SignatureHelper.java

/**
 * The message the signature will use/*  ww w . j a  va2s .c  o m*/
 *
 * @param order The order that will have the signature
 * @param merchantId The merchantId into the signature
 * @param key The apiKey of the merchant
 * @param valueFormat The format to use for decimal values
 * @return the message that will go into the signature
 */
private static String buildMessage(Order order, Integer merchantId, String key, String valueFormat) {

    validateOrder(order, merchantId);

    DecimalFormat df = (DecimalFormat) NumberFormat.getInstance(Locale.US);
    df.applyPattern(valueFormat);

    StringBuilder message = new StringBuilder();
    message.append(key);
    message.append("~");
    message.append(merchantId);
    message.append("~");
    message.append(order.getReferenceCode());
    message.append("~");
    message.append(df.format(order.getAdditionalValue(TX_VALUE).getValue().doubleValue()));
    message.append("~");
    message.append(order.getAdditionalValue(TX_VALUE).getCurrency().toString());

    return message.toString();
}

From source file:com.android.projecte.townportal.WeatherInfo.java

public String convertDate(long unixTime) {
    SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.US);
    Calendar cal = Calendar.getInstance();
    cal.setTimeInMillis(unixTime * 1000);
    sdf.setTimeZone(cal.getTimeZone());//  w  w  w  .j a v a2s  . co  m
    return sdf.format(cal.getTime());
}

From source file:com.anrisoftware.globalpom.dataimport.DefaultCsvImportProperties.java

/**
 * Sets system based default values./*from  w w w  .  j a  v a 2 s .  c  om*/
 */
@AssistedInject
public DefaultCsvImportProperties() {
    this.file = new File("").toURI();
    this.haveHeader = false;
    this.charset = decorate(Charset.defaultCharset());
    this.locale = Locale.US;
    this.separator = ',';
    this.quote = '"';
    this.endOfLineSymbols = System.getProperty("line.separator");
    this.startRow = 0;
    this.numCols = 0;
}

From source file:com.ibm.mobilefirst.mobileedge.recordapp.TestingActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_testing);

    detectedGesture = (TextView) findViewById(R.id.detectedGesture);
    score = (TextView) findViewById(R.id.scoring);

    detectedLayout = findViewById(R.id.detectedLayout);
    sensingLayout = findViewById(R.id.sensingLayout);

    getSupportActionBar().setTitle(R.string.testing_title);

    RecordApplication application = (RecordApplication) getApplication();
    controller = application.controller;

    textToSpeech = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
        @Override//from   ww  w  . ja v  a  2 s  . c  om
        public void onInit(int status) {
            if (status != TextToSpeech.ERROR) {
                textToSpeech.setLanguage(Locale.US);
            }
        }
    });
}

From source file:com.mercandalli.android.apps.files.user.UserModel.java

public UserModel(JSONObject json) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.US);
    try {//from w  ww  .  ja  v  a 2  s .co  m
        if (json.has("id")) {
            this.mId = json.getInt("id");
        }
        if (json.has("username")) {
            this.username = json.getString("username");
        }
        if (json.has("password")) {
            this.password = json.getString("password");
        }
        if (json.has("regId")) {
            this.regId = json.getString("regId");
        }
        if (json.has("date_creation") && !json.isNull("date_creation")) {
            this.date_creation = dateFormat.parse(json.getString("date_creation"));
        }
        if (json.has("date_last_connection") && !json.isNull("date_last_connection")) {
            this.mDateLastConnection = dateFormat.parse(json.getString("date_last_connection"));
        }
        if (json.has("size_files") && !json.isNull("size_files")) {
            this.size_files = json.getLong("size_files");
        }
        if (json.has("server_max_size_end_user") && !json.isNull("server_max_size_end_user")) {
            this.server_max_size_end_user = json.getLong("server_max_size_end_user");
        }
        if (json.has(ADMIN)) {
            final Object adminObj = json.get(ADMIN);
            if (adminObj instanceof Integer) {
                this.admin = json.getInt(ADMIN) == 1;
            } else if (adminObj instanceof Boolean) {
                this.admin = json.getBoolean(ADMIN);
            }
        }

        if (json.has("id_file_profile_picture")) {
            this.mIdFileProfilePicture = json.getInt("id_file_profile_picture");
        }
        if (json.has("file_profile_picture_size")) {
            this.file_profile_picture_size = json.getLong("file_profile_picture_size");
        }
        if (json.has("num_files") && !json.isNull("num_files")) {
            this.num_files = json.getLong("num_files");
        }

        userLocation = new UserLocationModel(json);

    } catch (JSONException | ParseException e) {
        Log.e(getClass().getName(), "Failed to convert Json", e);
    }

    if (hasPicture()) {
        FileModel.FileModelBuilder fileModelBuilder = new FileModel.FileModelBuilder();
        fileModelBuilder.id(this.mIdFileProfilePicture);
        fileModelBuilder.size(this.file_profile_picture_size);
        mPictureUrl = fileModelBuilder.build().getOnlineUrl();
    }
}

From source file:com.ichi2.libanki.sync.RemoteMediaServer.java

public JSONObject begin() throws UnknownHttpResponseException, MediaSyncException {
    try {/* w w w.  j  av  a 2 s.  c  o  m*/
        mPostVars = new HashMap<String, Object>();
        mPostVars.put("k", mHKey);
        mPostVars.put("v", String.format(Locale.US, "ankidroid,%s,%s", VersionUtils.getPkgVersionName(),
                Utils.platDesc()));

        HttpResponse resp = super.req("begin", super.getInputStream(Utils.jsonToString(new JSONObject())));
        JSONObject jresp = new JSONObject(super.stream2String(resp.getEntity().getContent()));
        JSONObject ret = _dataOnly(jresp, JSONObject.class);
        mSKey = ret.getString("sk");
        return ret;
    } catch (JSONException e) {
        throw new RuntimeException(e);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}

From source file:com.kii.sdk.photocolle.http.entity.mime.Header.java

public MinimalField getField(final String name) {
    if (name == null) {
        return null;
    }/* w  w  w.  j ava2 s  .c o  m*/
    String key = name.toLowerCase(Locale.US);
    List<MinimalField> list = this.fieldMap.get(key);
    if (list != null && !list.isEmpty()) {
        return list.get(0);
    }
    return null;
}