List of usage examples for java.util Locale JAPAN
Locale JAPAN
To view the source code for java.util Locale JAPAN.
Click Source Link
From source file:org.mule.transport.http.functional.HttpEncodingNonAsciiFunctionalTestCase.java
@Test public void testSendViaPostMap() throws Exception { Map<String, Object> messagePayload = new HashMap<String, Object>(); messagePayload.put("body", getTestMessage(Locale.JAPAN)); Map<String, Object> messageProperties = new HashMap<String, Object>(); messageProperties.put(MuleProperties.MULE_ENCODING_PROPERTY, "ISO-2022-JP"); doTestSend("POSTMap", messagePayload, messageProperties, FORM_ENCODED_CONTENT_TYPE_HEADER); }
From source file:jp.co.crypton.spinach.activities.LaunchScreen.java
void getDataIsConnectInternet() { AsyncHttpClient client = new AsyncHttpClient(); client.get(Constants.URL_BOOT, new AsyncHttpResponseHandler() { @Override//w ww . java2 s.com public void onStart() { // called before request is started Log.d(TAG, "AsyncHttpClient onStart"); } @Override public void onSuccess(int statusCode, Header[] headers, byte[] response) { String data = new String(response); Log.d(TAG, data); BootModel model = new Gson().fromJson(data, BootModel.class); for (Boot item : model.getBoot()) { boolean isJp = false; if (Locale.getDefault().equals(Locale.JAPAN) || Locale.getDefault().equals(Locale.JAPANESE)) { isJp = true; } String url = isJp ? item.getMsgJa() : item.getMsgEn(); if (item.getState() == 0) { Log.d(TAG, "onSuccess: " + item.getState()); gotoNextPage(); } else { // new AlertDialog.Builder(LaunchScreen.this) // .setMessage(url) // .setNegativeButton(R.string.btn_close, new DialogInterface.OnClickListener() { // @Override // public void onClick(DialogInterface dialog, int which) { // finish(); // } // }) // .show(); showAlertColorLicense(url); // finish(); } } } @Override public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Throwable e) { gotoNextPage(); Log.d(TAG, "AsyncHttpClient onFailure"); } @Override public void onRetry(int retryNo) { // called when request is retried Log.d(TAG, "onRetry: "); } }); }
From source file:com.android.email.mail.store.imap.ImapStringTest.java
/** * Confirms that getDateOrNull() works fine regardless of the current locale. *//*from w ww.j av a2 s .c om*/ public void testGetDateOrNullOnDifferentLocales() throws Exception { Locale savedLocale = Locale.getDefault(); try { Locale.setDefault(Locale.US); checkGetDateOrNullOnDifferentLocales(); Locale.setDefault(Locale.JAPAN); checkGetDateOrNullOnDifferentLocales(); } finally { Locale.setDefault(savedLocale); } }
From source file:org.eclipsetrader.yahoojapan.internal.core.connector.SnapshotConnector.java
public SnapshotConnector() { symbolSubscriptions = new HashMap<String, FeedSubscription>(); timeZone = TimeZone.getTimeZone("Asia/Tokyo"); dateTimeParser = new SimpleDateFormat("M/d H:m"); //$NON-NLS-1$ dateTimeParser.setTimeZone(timeZone); dateParser = new SimpleDateFormat("M/d"); //$NON-NLS-1$ dateParser.setTimeZone(timeZone);/*from ww w . ja va 2 s .c o m*/ timeParser = new SimpleDateFormat("H:m"); //$NON-NLS-1$ timeParser.setTimeZone(timeZone); numberFormat = NumberFormat.getInstance(Locale.JAPAN); }
From source file:org.mule.transport.http.functional.HttpEncodingNonAsciiFunctionalTestCase.java
private void doTestSend(String method, Object messagePayload, Map<String, Object> messageProperties, String expectedContentTypeHeader) throws Exception { Latch latch = new Latch(); setupAssertIncomingMessage(method, latch, expectedContentTypeHeader); MuleClient client = new MuleClient(muleContext); MuleMessage reply = client.send("vm://sendBy" + method, messagePayload, messageProperties); assertTrue(latch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS)); assertNotNull(reply);//from w w w . j a v a 2 s .c o m assertEquals("EUC-JP", reply.getEncoding()); assertEquals(getTestMessage(Locale.JAPAN) + " Received", reply.getPayloadAsString()); }
From source file:org.mule.transport.http.functional.HttpEncodingNonAsciiFunctionalTestCase.java
private void setupAssertIncomingMessage(String method, final Latch latch, final String expectedContentTypeHeader) throws Exception { FunctionalTestComponent ftc = getFunctionalTestComponent("testReceive" + method); ftc.setEventCallback(new EventCallback() { @Override//from www .j ava2s . co m public void eventReceived(MuleEventContext context, Object serviceComponent) throws Exception { MuleMessage message = context.getMessage(); Assert.assertEquals(expectedContentTypeHeader, message.getInboundProperty(HttpConstants.HEADER_CONTENT_TYPE, null)); Assert.assertEquals("ISO-2022-JP", message.getEncoding()); Object payload = message.getPayload(); if (payload instanceof String) { assertEquals(getTestMessage(Locale.JAPAN), payload); } else { fail(); } latch.countDown(); } }); }
From source file:com.codebutler.farebot.transit.suica.SuicaTrip.java
@Override public String getFareString() { NumberFormat format = NumberFormat.getCurrencyInstance(Locale.JAPAN); format.setMaximumFractionDigits(0);/*from w w w. j a v a2 s . c om*/ if (mFare < 0) { return "+" + format.format(-mFare); } else { return format.format(mFare); } }
From source file:com.codebutler.farebot.transit.suica.SuicaTrip.java
@Override public String getBalanceString() { NumberFormat format = NumberFormat.getCurrencyInstance(Locale.JAPAN); format.setMaximumFractionDigits(0);/*w ww . jav a 2 s. co m*/ return format.format(mBalance); }
From source file:com.vrem.wifianalyzer.wifi.channelgraph.ChannelGraphNavigationTest.java
@Test public void testUpdateGHZ5WithJapan() throws Exception { // setup/*from w ww . j a va 2s . c o m*/ when(settings.getCountryCode()).thenReturn(Locale.JAPAN.getCountry()); when(settings.getWiFiBand()).thenReturn(WiFiBand.GHZ5); when(settings.getSortBy()).thenReturn(SortBy.CHANNEL); // execute fixture.update(WiFiData.EMPTY); // validate verify(layout).setVisibility(View.VISIBLE); IterableUtils.forEach(views.keySet(), new Closure<Pair<WiFiChannel, WiFiChannel>>() { @Override public void execute(Pair<WiFiChannel, WiFiChannel> key) { verify(views.get(key)).setVisibility(WiFiChannelsGHZ5.SET3.equals(key) ? View.GONE : View.VISIBLE); } }); verify(settings).getCountryCode(); verify(settings, times(2)).getWiFiBand(); verify(settings).getSortBy(); }
From source file:jp.terasoluna.fw.util.DateUtil.java
/** * java.util.Date?????/* www.j av a2s. c om*/ * ?? * * <p> * ApplicationResources.properties * ????????? * ???????<br> * ?????????? * ?? * <strong> ApplicationResources.properties ? * ?</strong><br> * <code><pre> * wareki.gengo.0.name = ? * wareki.gengo.0.roman = H * wareki.gengo.0.startDate = 1989/01/08 * wareki.gengo.1.name = * wareki.gengo.1.roman = S * wareki.gengo.1.startDate = 1926/12/25 * wareki.gengo.2.name = * wareki.gengo.2.roman = T * wareki.gengo.2.startDate = 1912/07/30 * wareki.gengo.3.name = * wareki.gengo.3.roman = M * wareki.gengo.3.startDate = 1868/09/04 * </pre></code> * </p> * * <strong></strong><br> * <p>??java.text.SimpleDateFormat ? * <i></i> ????????? * ? SimpleDateFormat ?? * </p> * * <div width="90%" align="center"> * <table border="1"> * <tr> * <th>?</th> * <th><code> SimpleDateFormat</code> </th> * <th><code> dateToWarekiString()</code> </th> * </tr> * <tr> * <td>G</td> * <td align="left"><br><br><br>AD</td> * <td align="left">?<br><br> * <br> * 4???<br> * ????<br> * 3???<br> * M?T?S?H</td> * </tr> * <tr> * <td>y</td> * <td align="left"><br><br><br>2002</td> * <td align="left"><br><br><br>14</td> * </tr> * <tr> * <td>E</td> * <td align="left"><br><br><br>Tuesday</td> * <td align="left"><br><br> * <br> * 4???<br> * ???<br> * 3???<br> * ???</td> * </tr> * </table> * </div> * * <p>?????E????? SimpleDateFotmat * ???? "ja" * ???????</p> * * <p>????????????getWarekiGengoName()? * getWarekiGengoRoman()?getWarekiYear() ????? * ????????AplicationResources ? * ????</p> * * <p><code><pre> * wareki.gengo.<i>ID</i>.name=<i>???</i> * wareki.gengo.<i>ID</i>.roman=<i>??</i> * wareki.gengo.<i>ID</i>.startDate=<i>?:yyyy/MM/dd?</i> * </pre></code></p> * * <p>ID???????????????? * ???</p> * * @param format * @param date ??? * @return ????? */ public static String dateToWarekiString(String format, java.util.Date date) { // SimpleDateFormat?????'G'???'y'? // ??? StringBuilder sb = new StringBuilder(); boolean inQuote = false; // ??????? char prevCh = 0; int count = 0; for (int i = 0; i < format.length(); i++) { char ch = format.charAt(i); if (ch != prevCh && count > 0) { if (prevCh == 'G' && count >= 4) { sb.append(getWarekiGengoName(date)); } else if (prevCh == 'G') { // ??????????? sb.append('\''); sb.append(getWarekiGengoRoman(date)); sb.append('\''); } else if (prevCh == 'y') { sb.append(getWarekiYear(date)); } count = 0; } if (ch == '\'') { sb.append('\''); inQuote = !inQuote; } else if (!inQuote && (ch == 'G' || ch == 'y')) { // ch?????????? // ?? prevCh = ch; ++count; } else { // ???????? sb.append(ch); } } // ???? if (count > 0) { if (prevCh == 'G' && count >= 4) { sb.append(getWarekiGengoName(date)); } else if (prevCh == 'G') { sb.append('\''); sb.append(getWarekiGengoRoman(date)); sb.append('\''); } else if (prevCh == 'y') { sb.append(getWarekiYear(date)); } } SimpleDateFormat sdf = new SimpleDateFormat(sb.toString(), Locale.JAPAN); sdf.getCalendar().setLenient(false); sdf.setLenient(false); return sdf.format(date); }