- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {OutputStreamWriter o =
OutputStream out;new OutputStreamWriter(out)
OutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
HttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
- Smart code suggestions by Codota
}
/** * @return the default locale of the system or the locale set by {@link #setLocale(Locale)}. * @see ExportContext#getLocale() */ public Locale getLocale() { if (this.locale != null) { locale = ThreadLocalUserContext.getLocale(); } return locale; }
/** * Uses the scale of the BigDecimal. Uses the ThreadLocalUserContext locale. * @param value */ public static String format(final int value) { final NumberFormat format = NumberFormat.getNumberInstance(ThreadLocalUserContext.getLocale()); return format.format(value); }
/** * Uses the locale of the context user. * @param value * @return 1,234.00 € * @see #format(BigDecimal, Locale) */ public static String format(final BigDecimal value) { return format(value, ThreadLocalUserContext.getLocale()); }
public static Calendar getCalendar(TimeZone timeZone, Locale locale) { if (locale == null) { locale = ThreadLocalUserContext.getLocale(); } if (timeZone == null) { timeZone = ThreadLocalUserContext.getTimeZone(); } return Calendar.getInstance(timeZone, locale); }
/** * @return Short name of day represented by the giving day. The context user's locale and time zone is considered. */ public static final String formatShortNameOfDay(final Date date) { final DateFormat df = new SimpleDateFormat("EE", ThreadLocalUserContext.getLocale()); df.setTimeZone(ThreadLocalUserContext.getTimeZone()); return df.format(date); }
public static String getLocalizedString(final String key) { return I18nHelper.getLocalizedMessage(getLocale(), key); } }
/** * Uses {@link ThreadLocalUserContext#getLocale()} as locale. * @param s1 * @param s2 * @param asc * @return The result of {@link Collator#compare(String, String)}. * @see #compare(String, String, Locale) */ public int compare(final String s1, final String s2, final boolean asc) { return compare(s1, s2, asc, ThreadLocalUserContext.getLocale()); }
/** * @see ThreadLocalUserContext#getLocale() */ public static String formatFraction2(final Number value) { final Locale locale = ThreadLocalUserContext.getLocale(); final NumberFormat format = getNumberFraction2Format(locale); return format.format(value); }
/** * Uses the scale of the BigDecimal. Uses the ThreadLocalUserContext locale. * @param value */ public static String format(final BigDecimal value, final int scale) { return format(value, scale, ThreadLocalUserContext.getLocale()); }
/** * Uses patternKey SHORT_DATE_FORMAT * * @param dateTime * @see #getFormattedDateTime(Object, String, Locale, TimeZone) */ public String getFormattedDate(final Object date) { return getFormattedDate(date, ThreadLocalUserContext.getLocale(), ThreadLocalUserContext.getTimeZone()); }
/** * Gets the formatted time stamp with the context user's time zone and the internationalized pattern. * * @param dateTime * @param patternKey i18n key of the pattern */ public String getFormattedDateTime(final Date dateTime, final String pattern) { return getFormattedDateTime(dateTime, pattern, ThreadLocalUserContext.getLocale(), ThreadLocalUserContext.getTimeZone()); }
/** * Gets the formatted date (without time of day) with the context user's time zone and the internationalized pattern. * * @param date * @param patternKey i18n key of the pattern */ public String getFormattedDate(final Object date, final String pattern) { return getFormattedDate(date, pattern, ThreadLocalUserContext.getLocale(), ThreadLocalUserContext.getTimeZone()); }
/** * Sets or updates the locale of the user's session. Takes the locale of the user account or if not given the locale * of the given request. * * @param request */ public void setLocale(final Request request) { setLocale(ThreadLocalUserContext.getLocale(request.getLocale())); }
private ICalParser() { this.parseVEvent = new ArrayList<>(); // set user, timezone, locale this.user = ThreadLocalUserContext.getUser(); this.timeZone = ThreadLocalUserContext.getTimeZone(); this.locale = ThreadLocalUserContext.getLocale(); this.reset(); }
private ICalGenerator() { this.exportsVEvent = new ArrayList<>(); // set user, timezone, locale this.user = ThreadLocalUserContext.getUser(); this.timeZone = ThreadLocalUserContext.getTimeZone(); this.locale = ThreadLocalUserContext.getLocale(); this.reset(); }
@BeforeClass public void setUp() { Calendar c = Calendar.getInstance(); c.setTimeZone(DateHelper.EUROPE_BERLIN); PowerMockito.mockStatic(ThreadLocalUserContext.class); PowerMockito.when(ThreadLocalUserContext.getTimeZone()).thenReturn(c.getTimeZone()); PowerMockito.when(ThreadLocalUserContext.getLocale()).thenReturn(Locale.ENGLISH); }
@BeforeMethod public void setUp() { Mockito.reset(teamEventDao); MockitoAnnotations.initMocks(this); mockStatic(ThreadLocalUserContext.class); mockStatic(ConfigXml.class); Locale locale = Locale.getDefault(); TimeZone timeZone = TimeZone.getDefault(); PowerMockito.when(ThreadLocalUserContext.getLocale()).thenReturn(locale); PowerMockito.when(ThreadLocalUserContext.getTimeZone()).thenReturn(timeZone); }
public static LabelValueChoiceRenderer<UserPrefArea> createAreaChoiceRenderer(final Component parent) { // DropDownChoice area final LabelValueChoiceRenderer<UserPrefArea> areaChoiceRenderer = new LabelValueChoiceRenderer<UserPrefArea>(); for (final UserPrefArea area : UserPrefAreaRegistry.instance() .getOrderedEntries(ThreadLocalUserContext.getLocale())) { areaChoiceRenderer.addValue(area, parent.getString("userPref.area." + area.getKey())); } return areaChoiceRenderer; }
@BeforeMethod public void setUp() { MockitoAnnotations.initMocks(this); mockStatic(ThreadLocalUserContext.class); mockStatic(ConfigXml.class); ConfigXml configXml = new ConfigXml("./target/Projectforge"); PowerMockito.when(ThreadLocalUserContext.getLocale()).thenReturn(locale); PowerMockito.when(ThreadLocalUserContext.getTimeZone()).thenReturn(timeZone); PowerMockito.when(ConfigXml.getInstance()).thenReturn(configXml); systemService.setEnableVersionCheck(true); }
public VersionCheck getVersionCheckInformations() { Locale locale = ThreadLocalUserContext.getUser() != null && ThreadLocalUserContext.getUser().getLocale() != null ? ThreadLocalUserContext.getUser().getLocale() : ThreadLocalUserContext.getLocale(); TimeZone timeZone = ThreadLocalUserContext.getUser() != null && ThreadLocalUserContext.getUser().getTimeZone() != null ? TimeZone.getTimeZone(ThreadLocalUserContext.getUser().getTimeZone()) : ThreadLocalUserContext.getTimeZone(); VersionCheck versionCheck = new VersionCheck(AppVersion.VERSION.toString(), locale, timeZone); versionCheck = restCallService.callRestInterfaceForUrl(versionCheckUrl, HttpMethod.POST, VersionCheck.class, versionCheck); return versionCheck; }