List of usage examples for java.util Locale US
Locale US
To view the source code for java.util Locale US.
Click Source Link
From source file:elt.generaltest.TmpTest.java
@Test public void timestampreversetest() { SimpleDateFormat ISO8601DATEFORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US); // 2016-05-14T22:01:34-07:00 // 2010-01-01T12:00:00+01:00 String date = "2010-01-01T12:00:00+01:00".replaceAll("\\+0([0-9]){1}\\:00", "+0$100"); try {//from w w w . j a v a 2 s . c om Date tmp = ISO8601DATEFORMAT.parse(date); System.out.println(tmp.getTime()); } catch (ParseException ex) { Logger.getLogger(TmpTest.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.deltachi.videotex.grabers.IMDBGraber.java
@Override public Video getVideo(String imdbCode) throws JSONException, IOException { Video video = null;//w ww. j a va2 s . c o m JSONReader jsonReader = new JSONReader(); JSONObject jSONObject = null; jSONObject = jsonReader.readJsonFromUrl("http://www.omdbapi.com/?i=" + imdbCode); video = new Video(); video.setTitle(jSONObject.get("Title").toString()); video.setYear(Integer.parseInt(jSONObject.get("Year").toString())); video.setRated(jSONObject.get("Rated").toString()); String releasedString = jSONObject.get("Released").toString(); SimpleDateFormat releasedFormat = new SimpleDateFormat("dd MMM yyyy", Locale.US); Date released = null; try { released = releasedFormat.parse(releasedString); } catch (ParseException ex) { Logger.getLogger(IMDBGraber.class.getName()).log(Level.SEVERE, null, ex); } video.setReleased(released); video.setRuntime(jSONObject.get("Runtime").toString()); String[] genres = jSONObject.get("Genre").toString().split(", "); Collection<Genre> genreCollection = new ArrayList<>(); for (String genres1 : genres) { Genre genre = new Genre(); genre.setName(genres1); genreCollection.add(genre); } video.setGenreCollection(genreCollection); video.setDirector(jSONObject.get("Director").toString()); video.setWriter("Writer"); video.setActors(jSONObject.get("Actors").toString()); video.setPlot(jSONObject.get("Plot").toString()); video.setLanguage(jSONObject.get("Language").toString()); video.setCountry(jSONObject.get("Country").toString()); video.setAwards(jSONObject.get("Awards").toString()); URL posterUrl = null; try { posterUrl = new URL(jSONObject.get("Poster").toString()); } catch (MalformedURLException ex) { Logger.getLogger(IMDBGraber.class.getName()).log(Level.SEVERE, null, ex); } byte[] posterFile = null; try { posterFile = Downloader.getAsByteArray(posterUrl); } catch (IOException ex) { Logger.getLogger(IMDBGraber.class.getName()).log(Level.SEVERE, null, ex); } video.setPoster(posterFile); video.setRating(Float.parseFloat(jSONObject.get("imdbRating").toString())); video.setImdbCode(imdbCode); return video; }
From source file:Decomposition.java
public Decomposition() { String pairs[][] = new String[3][3]; pairs[0][0] = "Half-Width and full-width A"; pairs[0][1] = "A"; pairs[0][2] = "\uFF21"; // full-width A pairs[1][0] = "A with Ring and Angstrom Sign"; pairs[1][1] = "\u00c5"; // A with ring pairs[1][2] = "\u212b"; // Angstrom pairs[2][0] = "a + umlaut and precomposed a-umlaut"; pairs[2][1] = "a\u0308"; pairs[2][2] = "\u00e4"; for (int i = 0; i < 3; i++) { Collator collate = Collator.getInstance(Locale.US); collate.setStrength(Collator.IDENTICAL); System.out.println("Comparing " + pairs[i][0]); collate.setDecomposition(Collator.NO_DECOMPOSITION); compare(collate, pairs[i][1], pairs[i][2]); collate.setDecomposition(Collator.CANONICAL_DECOMPOSITION); compare(collate, pairs[i][1], pairs[i][2]); collate.setDecomposition(Collator.FULL_DECOMPOSITION); compare(collate, pairs[i][1], pairs[i][2]); System.out.println(""); }/*from w w w. j a v a 2s. c o m*/ }
From source file:com.aestheticsw.jobkeywords.service.termextractor.impl.fivefilters.FiveFiltersClientTest.java
@Test public void realJobTerms() throws FileNotFoundException { String content = FileUtils.getClassResourceAsString("../indeed-content.html", this); TermFrequencyList terms = fiveFiltersClient.getTermFrequencyList(content, Locale.US); assertNotNull(terms);// w w w . ja va2 s. co m }
From source file:org.thymeleaf.spring3.view.ThymeleafViewResolverTest.java
@Test public void testConfigureViewBean() throws Exception { final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "classpath:spring3/view/applicationContext.xml"); final ThymeleafViewResolver resolver = new ThymeleafViewResolver(); resolver.setApplicationContext(context); resolver.setViewClass(TestThymeleafView.class); final View view = resolver.loadView("testview", Locale.US); final String viewValue = ((TestThymeleafView) view).getSomething(); Assert.assertEquals("view_value", viewValue); final TestThymeleafView.ViewBean viewBean = ((TestThymeleafView) view).getViewBean(); Assert.assertNotNull(viewBean);//w w w .j a v a 2 s. c o m final String beanValue = viewBean.getValue(); Assert.assertEquals("bean_value", beanValue); }
From source file:org.thymeleaf.spring4.view.ThymeleafViewResolverTest.java
@Test public void testConfigureViewBean() throws Exception { final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "classpath:spring4/view/applicationContext.xml"); final ThymeleafViewResolver resolver = new ThymeleafViewResolver(); resolver.setApplicationContext(context); resolver.setViewClass(TestThymeleafView.class); final View view = resolver.loadView("testview", Locale.US); final String viewValue = ((TestThymeleafView) view).getSomething(); Assert.assertEquals("view_value", viewValue); final TestThymeleafView.ViewBean viewBean = ((TestThymeleafView) view).getViewBean(); Assert.assertNotNull(viewBean);/* w ww .j a v a 2 s . com*/ final String beanValue = viewBean.getValue(); Assert.assertEquals("bean_value", beanValue); }
From source file:com.gs.obevo.db.testutil.TestTemplateUtil.java
private TestTemplateUtil() { this.templateConfig = new Configuration(); // Where load the templates from: templateConfig.setClassForTemplateLoading(RevengWriter.class, "/"); // Some other recommended settings: templateConfig.setDefaultEncoding("UTF-8"); templateConfig.setLocale(Locale.US); templateConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); }
From source file:com.github.horrorho.liquiddonkey.util.Bytes.java
public static String hex(byte[] bytes) { if (bytes == null) { return "null"; }//from ww w.j a v a2 s . c om return Hex.encodeHexString(bytes).toLowerCase(Locale.US); }
From source file:org.siddhiesb.transport.http.conn.ProxyConfig.java
public ProxyConfig(final HttpHost proxy, final UsernamePasswordCredentials creds, final String[] proxyBypass) { super();/*from w w w .ja v a2 s . c om*/ this.proxy = proxy; this.creds = creds; if (proxyBypass != null) { this.proxyBypass = new LinkedHashSet<String>(proxyBypass.length); for (String s : proxyBypass) { this.proxyBypass.add(s.trim().toLowerCase(Locale.US)); } } else { this.proxyBypass = Collections.<String>emptySet(); } }
From source file:XSDDateTime.java
public static Calendar parse(String dt) { String[] dateTime = dt.split("T"); String date = dateTime[0];/* w w w . j av a2 s . c o m*/ String time = dateTime[1]; String[] ymd = date.split("-"); int year = Integer.parseInt(ymd[0]); int month = Integer.parseInt(ymd[1]) - 1; int day = Integer.parseInt(ymd[2]); String[] hms = time.split(":"); int hour = Integer.parseInt(hms[0]); int minutes = Integer.parseInt(hms[1]); int seconds = Integer.parseInt(hms[2].substring(0, 2)); TimeZone tz = TimeZone.getTimeZone("GMT+00:00"); Calendar cal = Calendar.getInstance(tz, Locale.US); cal.set(year, month, day, hour, minutes, seconds); return cal; }