code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@Override
public final Boolean optBool(final String key) {
if (this.obj.optString(key, null) == null) {
return null;
} else {
return this.obj.optBoolean(key);
}
} | java |
public final PJsonObject optJSONObject(final String key) {
final JSONObject val = this.obj.optJSONObject(key);
return val != null ? new PJsonObject(this, val, key) : null;
} | java |
public final PJsonArray getJSONArray(final String key) {
final JSONArray val = this.obj.optJSONArray(key);
if (val == null) {
throw new ObjectMissingException(this, key);
}
return new PJsonArray(this, val, key);
} | java |
public final PJsonArray optJSONArray(final String key, final PJsonArray defaultValue) {
PJsonArray result = optJSONArray(key);
return result != null ? result : defaultValue;
} | java |
@Override
public final boolean has(final String key) {
String result = this.obj.optString(key, null);
return result != null;
} | java |
public void setAttributes(final Map<String, Attribute> attributes) {
this.internalAttributes = attributes;
this.allAttributes.putAll(attributes);
} | java |
public void setAttribute(final String name, final Attribute attribute) {
if (name.equals("datasource")) {
this.allAttributes.putAll(((DataSourceAttribute) attribute).getAttributes());
} else if (this.copyAttributes.contains(name)) {
this.allAttributes.put(name, attribute);
... | java |
@Nonnull
public String getBody() {
if (body == null) {
return storage == null ? DEFAULT_BODY : DEFAULT_BODY_STORAGE;
} else {
return body;
}
} | java |
private boolean isTileVisible(final ReferencedEnvelope tileBounds) {
if (FloatingPointUtil.equals(this.transformer.getRotation(), 0.0)) {
return true;
}
final GeometryFactory gfac = new GeometryFactory();
final Optional<Geometry> rotatedMapBounds = getRotatedMapBounds(gfac);... | java |
private List<Rule> getStyleRules(final String styleProperty) {
final List<Rule> styleRules = new ArrayList<>(this.json.size());
for (Iterator<String> iterator = this.json.keys(); iterator.hasNext(); ) {
String styleKey = iterator.next();
if (styleKey.equals(JSON_STYLE_PROPERTY) ... | java |
public void setHeaders(final Set<String> names) {
// transform to lower-case because header names should be case-insensitive
Set<String> lowerCaseNames = new HashSet<>();
for (String name: names) {
lowerCaseNames.add(name.toLowerCase());
}
this.headerNames = lowerCase... | java |
public static Multimap<String, String> convertToMultiMap(final PObject objectParams) {
Multimap<String, String> params = HashMultimap.create();
if (objectParams != null) {
Iterator<String> customParamsIter = objectParams.keys();
while (customParamsIter.hasNext()) {
... | java |
public Envelope getMaxExtent() {
final int minX = 0;
final int maxX = 1;
final int minY = 2;
final int maxY = 3;
return new Envelope(this.maxExtent[minX], this.maxExtent[minY], this.maxExtent[maxX],
this.maxExtent[maxY]);
} | java |
public final void setConfigurationFiles(final Map<String, String> configurationFiles)
throws URISyntaxException {
this.configurationFiles.clear();
this.configurationFileLastModifiedTimes.clear();
for (Map.Entry<String, String> entry: configurationFiles.entrySet()) {
if (!... | java |
public final ZoomToFeatures copy() {
ZoomToFeatures obj = new ZoomToFeatures();
obj.zoomType = this.zoomType;
obj.minScale = this.minScale;
obj.minMargin = this.minMargin;
return obj;
} | java |
public String getFullContentType() {
final String url = this.url.toExternalForm().substring("data:".length());
final int endIndex = url.indexOf(',');
if (endIndex >= 0) {
final String contentType = url.substring(0, endIndex);
if (!contentType.isEmpty()) {
... | java |
@Override
public final Optional<Boolean> tryOverrideValidation(final MatchInfo matchInfo) throws SocketException,
UnknownHostException, MalformedURLException {
for (AddressHostMatcher addressHostMatcher: this.matchersForHost) {
if (addressHostMatcher.matches(matchInfo)) {
... | java |
public final void setHost(final String host) throws UnknownHostException {
this.host = host;
final InetAddress[] inetAddresses = InetAddress.getAllByName(host);
for (InetAddress address: inetAddresses) {
final AddressHostMatcher matcher = new AddressHostMatcher();
matche... | java |
@SuppressWarnings("unchecked")
public Multimap<String, Processor> getAllRequiredAttributes() {
Multimap<String, Processor> requiredInputs = HashMultimap.create();
for (ProcessorGraphNode root: this.roots) {
final BiMap<String, String> inputMapper = root.getInputMapper();
for ... | java |
public Set<Processor<?, ?>> getAllProcessors() {
IdentityHashMap<Processor<?, ?>, Void> all = new IdentityHashMap<>();
for (ProcessorGraphNode<?, ?> root: this.roots) {
for (Processor p: root.getAllProcessors()) {
all.put(p, null);
}
}
return all.k... | java |
public void validate(final List<Throwable> validationErrors) {
if (this.matchers == null) {
validationErrors.add(new IllegalArgumentException(
"Matchers cannot be null. There should be at least a !acceptAll matcher"));
}
if (this.matchers != null && this.matchers... | java |
@PostConstruct
public final void init() throws URISyntaxException {
final String address = getConfig(ADDRESS, null);
if (address != null) {
final URI uri = new URI("udp://" + address);
final String prefix = getConfig(PREFIX, "mapfish-print").replace("%h", getHostname());
... | java |
public static MapBounds adjustBoundsToScaleAndMapSize(
final GenericMapAttributeValues mapValues,
final Rectangle paintArea,
final MapBounds bounds,
final double dpi) {
MapBounds newBounds = bounds;
if (mapValues.isUseNearestScale()) {
newBound... | java |
public static SVGGraphics2D createSvgGraphics(final Dimension size)
throws ParserConfigurationException {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document document = db.getDOMImplementation().createDocument(nul... | java |
public static void saveSvgFile(final SVGGraphics2D graphics2d, final File path) throws IOException {
try (FileOutputStream fs = new FileOutputStream(path);
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fs, StandardCharsets.UTF_8);
Writer osw = new BufferedWriter(output... | java |
@Nonnull
private ReferencedEnvelope getFeatureBounds(
final MfClientHttpRequestFactory clientHttpRequestFactory,
final MapAttributeValues mapValues, final ExecutionContext context) {
final MapfishMapContext mapContext = createMapContext(mapValues);
String layerName = mapValu... | java |
public final File getJasperCompilation(final Configuration configuration) {
File jasperCompilation = new File(getWorking(configuration), "jasper-bin");
createIfMissing(jasperCompilation, "Jasper Compilation");
return jasperCompilation;
} | java |
public final File getTaskDirectory() {
createIfMissing(this.working, "Working");
try {
return Files.createTempDirectory(this.working.toPath(), TASK_DIR_PREFIX).toFile();
} catch (IOException e) {
throw new AssertionError("Unable to create temporary directory in '" + this.... | java |
public final void removeDirectory(final File directory) {
try {
FileUtils.deleteDirectory(directory);
} catch (IOException e) {
LOGGER.error("Unable to delete directory '{}'", directory);
}
} | java |
public final File getBuildFileFor(
final Configuration configuration, final File jasperFileXml,
final String extension, final Logger logger) {
final String configurationAbsolutePath = configuration.getDirectory().getPath();
final int prefixToConfiguration = configurationAbsoluteP... | java |
public static URI createRestURI(
final String matrixId, final int row, final int col,
final WMTSLayerParam layerParam) throws URISyntaxException {
String path = layerParam.baseURL;
if (layerParam.dimensions != null) {
for (int i = 0; i < layerParam.dimensions.length; ... | java |
public final String getPath(final String key) {
StringBuilder result = new StringBuilder();
addPathTo(result);
result.append(".");
result.append(getPathElement(key));
return result.toString();
} | java |
protected final void addPathTo(final StringBuilder result) {
if (this.parent != null) {
this.parent.addPathTo(result);
if (!(this.parent instanceof PJsonArray)) {
result.append(".");
}
}
result.append(getPathElement(this.contextName));
} | java |
public static void main(final String[] args) {
if (System.getProperty("db.name") == null) {
System.out.println("Not running in multi-instance mode: no DB to connect to");
System.exit(1);
}
while (true) {
try {
Class.forName("org.postgresql.Driv... | java |
private void started(final ProcessorGraphNode processorGraphNode) {
this.processorLock.lock();
try {
this.runningProcessors.put(processorGraphNode.getProcessor(), null);
} finally {
this.processorLock.unlock();
}
} | java |
public boolean isRunning(final ProcessorGraphNode processorGraphNode) {
this.processorLock.lock();
try {
return this.runningProcessors.containsKey(processorGraphNode.getProcessor());
} finally {
this.processorLock.unlock();
}
} | java |
public boolean isFinished(final ProcessorGraphNode processorGraphNode) {
this.processorLock.lock();
try {
return this.executedProcessors.containsKey(processorGraphNode.getProcessor());
} finally {
this.processorLock.unlock();
}
} | java |
public void finished(final ProcessorGraphNode processorGraphNode) {
this.processorLock.lock();
try {
this.runningProcessors.remove(processorGraphNode.getProcessor());
this.executedProcessors.put(processorGraphNode.getProcessor(), null);
} finally {
this.proces... | java |
public final void draw() {
AffineTransform transform = new AffineTransform(this.transform);
transform.concatenate(getAlignmentTransform());
// draw the background box
this.graphics2d.setTransform(transform);
this.graphics2d.setColor(this.params.getBackgroundColor());
thi... | java |
private AffineTransform getAlignmentTransform() {
final int offsetX;
switch (this.settings.getParams().getAlign()) {
case LEFT:
offsetX = 0;
break;
case RIGHT:
offsetX = this.settings.getMaxSize().width - this.settings.getSize().wid... | java |
protected final MapfishMapContext getLayerTransformer(final MapfishMapContext transformer) {
MapfishMapContext layerTransformer = transformer;
if (!FloatingPointUtil.equals(transformer.getRotation(), 0.0) && !this.supportsNativeRotation()) {
// if a rotation is set and the rotation can not ... | java |
public static void log(final String templateName, final Template template, final Values values) {
new ValuesLogger().doLog(templateName, template, values);
} | java |
private static String getFileName(@Nullable final MapPrinter mapPrinter, final PJsonObject spec) {
String fileName = spec.optString(Constants.OUTPUT_FILENAME_KEY);
if (fileName != null) {
return fileName;
}
if (mapPrinter != null) {
final Configuration config = m... | java |
protected PrintResult withOpenOutputStream(final PrintAction function) throws Exception {
final File reportFile = getReportFile();
final Processor.ExecutionContext executionContext;
try (FileOutputStream out = new FileOutputStream(reportFile);
BufferedOutputStream bout = new Buffere... | java |
static Style get(final GridParam params) {
final StyleBuilder builder = new StyleBuilder();
final Symbolizer pointSymbolizer = crossSymbolizer("shape://plus", builder, CROSS_SIZE,
params.gridColor);
final Style style = builder.createSty... | java |
public Scale get(final int index, final DistanceUnit unit) {
return new Scale(this.scaleDenominators[index], unit, PDF_DPI);
} | java |
public double[] getScaleDenominators() {
double[] dest = new double[this.scaleDenominators.length];
System.arraycopy(this.scaleDenominators, 0, dest, 0, this.scaleDenominators.length);
return dest;
} | java |
public final SimpleFeatureCollection autoTreat(final Template template, final String features)
throws IOException {
SimpleFeatureCollection featuresCollection = treatStringAsURL(template, features);
if (featuresCollection == null) {
featuresCollection = treatStringAsGeoJson(featu... | java |
public final SimpleFeatureCollection treatStringAsURL(final Template template, final String geoJsonUrl)
throws IOException {
URL url;
try {
url = FileUtils.testForLegalFileUrl(template.getConfiguration(), new URL(geoJsonUrl));
} catch (MalformedURLException e) {
... | java |
@Override
public boolean supportsNativeRotation() {
return this.params.useNativeAngle &&
(this.params.serverType == WmsLayerParam.ServerType.MAPSERVER ||
this.params.serverType == WmsLayerParam.ServerType.GEOSERVER);
} | java |
protected static File platformIndependentUriToFile(final URI fileURI) {
File file;
try {
file = new File(fileURI);
} catch (IllegalArgumentException e) {
if (fileURI.toString().startsWith("file://")) {
file = new File(fileURI.toString().substring("file://"... | java |
public static String getContext(final PObject[] objs) {
StringBuilder result = new StringBuilder("(");
boolean first = true;
for (PObject obj: objs) {
if (!first) {
result.append('|');
}
first = false;
result.append(obj.getCurrentPa... | java |
public final void save(final PrintJobStatusExtImpl entry) {
getSession().merge(entry);
getSession().flush();
getSession().evict(entry);
} | java |
public final Object getValue(final String id, final String property) {
final CriteriaBuilder builder = getSession().getCriteriaBuilder();
final CriteriaQuery<Object> criteria = builder.createQuery(Object.class);
final Root<PrintJobStatusExtImpl> root = criteria.from(PrintJobStatusExtImpl.class);... | java |
public final void cancelOld(
final long starttimeThreshold, final long checkTimeThreshold, final String message) {
final CriteriaBuilder builder = getSession().getCriteriaBuilder();
final CriteriaUpdate<PrintJobStatusExtImpl> update =
builder.createCriteriaUpdate(PrintJobStat... | java |
public final void updateLastCheckTime(final String id, final long lastCheckTime) {
final CriteriaBuilder builder = getSession().getCriteriaBuilder();
final CriteriaUpdate<PrintJobStatusExtImpl> update =
builder.createCriteriaUpdate(PrintJobStatusExtImpl.class);
final Root<PrintJo... | java |
public final int deleteOld(final long checkTimeThreshold) {
final CriteriaBuilder builder = getSession().getCriteriaBuilder();
final CriteriaDelete<PrintJobStatusExtImpl> delete =
builder.createCriteriaDelete(PrintJobStatusExtImpl.class);
final Root<PrintJobStatusExtImpl> root = ... | java |
public final List<PrintJobStatusExtImpl> poll(final int size) {
final CriteriaBuilder builder = getSession().getCriteriaBuilder();
final CriteriaQuery<PrintJobStatusExtImpl> criteria =
builder.createQuery(PrintJobStatusExtImpl.class);
final Root<PrintJobStatusExtImpl> root = crit... | java |
public final PrintJobResultExtImpl getResult(final URI reportURI) {
final CriteriaBuilder builder = getSession().getCriteriaBuilder();
final CriteriaQuery<PrintJobResultExtImpl> criteria =
builder.createQuery(PrintJobResultExtImpl.class);
final Root<PrintJobResultExtImpl> root = ... | java |
public void delete(final String referenceId) {
final CriteriaBuilder builder = getSession().getCriteriaBuilder();
final CriteriaDelete<PrintJobStatusExtImpl> delete =
builder.createCriteriaDelete(PrintJobStatusExtImpl.class);
final Root<PrintJobStatusExtImpl> root = delete.from(P... | java |
public final void configureAccess(final Template template, final ApplicationContext context) {
final Configuration configuration = template.getConfiguration();
AndAccessAssertion accessAssertion = context.getBean(AndAccessAssertion.class);
accessAssertion.setPredicates(configuration.getAccessAs... | java |
protected final <T> StyleSupplier<T> createStyleSupplier(
final Template template,
final String styleRef) {
return new StyleSupplier<T>() {
@Override
public Style load(
final MfClientHttpRequestFactory requestFactory,
final ... | java |
private void store(final PrintJobStatus printJobStatus) throws JSONException {
JSONObject metadata = new JSONObject();
metadata.put(JSON_REQUEST_DATA, printJobStatus.getEntry().getRequestData().getInternalObj());
metadata.put(JSON_STATUS, printJobStatus.getStatus().toString());
metadata.... | java |
public static boolean canParseColor(final String colorString) {
try {
return ColorParser.toColor(colorString) != null;
} catch (Exception exc) {
return false;
}
} | java |
private static Dimension adaptTileDimensions(
final Dimension pixels, final int maxWidth, final int maxHeight) {
return new Dimension(adaptTileDimension(pixels.width, maxWidth),
adaptTileDimension(pixels.height, maxHeight));
} | java |
public static Multimap<String, String> getParameters(final String rawQuery) {
Multimap<String, String> result = HashMultimap.create();
if (rawQuery == null) {
return result;
}
StringTokenizer tokens = new StringTokenizer(rawQuery, "&");
while (tokens.hasMoreTokens())... | java |
public static URI setQueryParams(final URI initialUri, final Multimap<String, String> queryParams) {
StringBuilder queryString = new StringBuilder();
for (Map.Entry<String, String> entry: queryParams.entries()) {
if (queryString.length() > 0) {
queryString.append("&");
... | java |
public static URI setPath(final URI initialUri, final String path) {
String finalPath = path;
if (!finalPath.startsWith("/")) {
finalPath = '/' + path;
}
try {
if (initialUri.getHost() == null && initialUri.getAuthority() != null) {
return new URI(... | java |
public final PJsonArray toJSON() {
JSONArray jsonArray = new JSONArray();
final int size = this.array.size();
for (int i = 0; i < size; i++) {
final Object o = get(i);
if (o instanceof PYamlObject) {
PYamlObject pYamlObject = (PYamlObject) o;
... | java |
@PostConstruct
public void checkUniqueSchemes() {
Multimap<String, ConfigFileLoaderPlugin> schemeToPluginMap = HashMultimap.create();
for (ConfigFileLoaderPlugin plugin: getLoaderPlugins()) {
schemeToPluginMap.put(plugin.getUriScheme(), plugin);
}
StringBuilder violatio... | java |
public Set<String> getSupportedUriSchemes() {
Set<String> schemes = new HashSet<>();
for (ConfigFileLoaderPlugin loaderPlugin: this.getLoaderPlugins()) {
schemes.add(loaderPlugin.getUriScheme());
}
return schemes;
} | java |
public static CoordinateReferenceSystem parseProjection(
final String projection, final Boolean longitudeFirst) {
try {
if (longitudeFirst == null) {
return CRS.decode(projection);
} else {
return CRS.decode(projection, longitudeFirst);
... | java |
public final double[] getDpiSuggestions() {
if (this.dpiSuggestions == null) {
List<Double> list = new ArrayList<>();
for (double suggestion: DEFAULT_DPI_VALUES) {
if (suggestion <= this.maxDpi) {
list.add(suggestion);
}
}
... | java |
protected BufferedImage createErrorImage(final Rectangle area) {
final BufferedImage bufferedImage = new BufferedImage(area.width, area.height, TYPE_INT_ARGB_PRE);
final Graphics2D graphics = bufferedImage.createGraphics();
try {
graphics.setBackground(ColorParser.toColor(this.config... | java |
protected BufferedImage fetchImage(
@Nonnull final ClientHttpRequest request, @Nonnull final MapfishMapContext transformer)
throws IOException {
final String baseMetricName = getClass().getName() + ".read." +
StatsUtils.quotePart(request.getURI().getHost());
final... | java |
@SafeVarargs
public static <T> Set<T> create(final T... values) {
Set<T> result = new HashSet<>(values.length);
Collections.addAll(result, values);
return result;
} | java |
@SuppressWarnings({"deprecation", "WeakerAccess"})
protected void removeShutdownHook(ClassLoaderLeakPreventor preventor, Thread shutdownHook) {
final String displayString = "'" + shutdownHook + "' of type " + shutdownHook.getClass().getName();
preventor.error("Removing shutdown hook: " + displayString);
R... | java |
protected static int getIntInitParameter(ServletContext servletContext, String parameterName, int defaultValue) {
final String parameterString = servletContext.getInitParameter(parameterName);
if(parameterString != null && parameterString.trim().length() > 0) {
try {
return Integer.parseInt(parame... | java |
@SuppressWarnings("WeakerAccess")
protected void clearRmiTargetsMap(ClassLoaderLeakPreventor preventor, Map<?, ?> rmiTargetsMap) {
try {
final Field cclField = preventor.findFieldOfClass("sun.rmi.transport.Target", "ccl");
preventor.debug("Looping " + rmiTargetsMap.size() + " RMI Targets to find leaks... | java |
@SuppressWarnings("WeakerAccess")
protected boolean isJettyWithJMX(ClassLoaderLeakPreventor preventor) {
final ClassLoader classLoader = preventor.getClassLoader();
try {
// If package org.eclipse.jetty is found, we may be running under jetty
if (classLoader.getResource("org/eclipse/jetty") == nul... | java |
public long[] keys() {
long[] values = new long[size];
int idx = 0;
for (Entry entry : table) {
while (entry != null) {
values[idx++] = entry.key;
entry = entry.next;
}
}
return values;
} | java |
public Entry<T>[] entries() {
@SuppressWarnings("unchecked")
Entry<T>[] entries = new Entry[size];
int idx = 0;
for (Entry entry : table) {
while (entry != null) {
entries[idx++] = entry;
entry = entry.next;
}
}
retu... | java |
public boolean add(long key) {
final int index = ((((int) (key >>> 32)) ^ ((int) (key))) & 0x7fffffff) % capacity;
final Entry entryOriginal = table[index];
for (Entry entry = entryOriginal; entry != null; entry = entry.next) {
if (entry.key == key) {
return false;
... | java |
public boolean remove(long key) {
int index = ((((int) (key >>> 32)) ^ ((int) (key))) & 0x7fffffff) % capacity;
Entry previous = null;
Entry entry = table[index];
while (entry != null) {
Entry next = entry.next;
if (entry.key == key) {
if (previous... | java |
public VALUE put(KEY key, VALUE object) {
CacheEntry<VALUE> entry;
if (referenceType == ReferenceType.WEAK) {
entry = new CacheEntry<>(new WeakReference<>(object), null);
} else if (referenceType == ReferenceType.SOFT) {
entry = new CacheEntry<>(new SoftReference<>(object... | java |
public void putAll(Map<KEY, VALUE> mapDataToPut) {
int targetSize = maxSize - mapDataToPut.size();
if (maxSize > 0 && values.size() > targetSize) {
evictToTargetSize(targetSize);
}
Set<Entry<KEY, VALUE>> entries = mapDataToPut.entrySet();
for (Entry<KEY, VALUE> entry ... | java |
public VALUE get(KEY key) {
CacheEntry<VALUE> entry;
synchronized (this) {
entry = values.get(key);
}
VALUE value;
if (entry != null) {
if (isExpiring) {
long age = System.currentTimeMillis() - entry.timeCreated;
if (age < e... | java |
public static int copyAllBytes(InputStream in, OutputStream out) throws IOException {
int byteCount = 0;
byte[] buffer = new byte[BUFFER_SIZE];
while (true) {
int read = in.read(buffer);
if (read == -1) {
break;
}
out.write(buffer, ... | java |
public synchronized int get() {
if (available == 0) {
return -1;
}
byte value = buffer[idxGet];
idxGet = (idxGet + 1) % capacity;
available--;
return value;
} | java |
public synchronized int get(byte[] dst, int off, int len) {
if (available == 0) {
return 0;
}
// limit is last index to read + 1
int limit = idxGet < idxPut ? idxPut : capacity;
int count = Math.min(limit - idxGet, len);
System.arraycopy(buffer, idxGet, dst, ... | java |
public synchronized boolean put(byte value) {
if (available == capacity) {
return false;
}
buffer[idxPut] = value;
idxPut = (idxPut + 1) % capacity;
available++;
return true;
} | java |
public synchronized int put(byte[] src, int off, int len) {
if (available == capacity) {
return 0;
}
// limit is last index to put + 1
int limit = idxPut < idxGet ? idxGet : capacity;
int count = Math.min(limit - idxPut, len);
System.arraycopy(src, off, buffe... | java |
public synchronized int skip(int count) {
if (count > available) {
count = available;
}
idxGet = (idxGet + count) % capacity;
available -= count;
return count;
} | java |
public static Object readObject(File file) throws IOException,
ClassNotFoundException {
FileInputStream fileIn = new FileInputStream(file);
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(fileIn));
try {
return in.readObject();
} finally {
... | java |
public static void writeObject(File file, Object object) throws IOException {
FileOutputStream fileOut = new FileOutputStream(file);
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(fileOut));
try {
out.writeObject(object);
out.flush();
... | java |
public static void setTime(Calendar calendar, int hourOfDay, int minute, int second, int millisecond) {
calendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, second);
calendar.set(Calendar.MILLISECOND, millisecond);
} | java |
public static int getDayAsReadableInt(long time) {
Calendar cal = calendarThreadLocal.get();
cal.setTimeInMillis(time);
return getDayAsReadableInt(cal);
} | java |
public static int getDayAsReadableInt(Calendar calendar) {
int day = calendar.get(Calendar.DAY_OF_MONTH);
int month = calendar.get(Calendar.MONTH) + 1;
int year = calendar.get(Calendar.YEAR);
return year * 10000 + month * 100 + day;
} | java |
public static String encodeUrlIso(String stringToEncode) {
try {
return URLEncoder.encode(stringToEncode, "ISO-8859-1");
} catch (UnsupportedEncodingException e1) {
throw new RuntimeException(e1);
}
} | java |
public static String decodeUrl(String stringToDecode) {
try {
return URLDecoder.decode(stringToDecode, "UTF-8");
} catch (UnsupportedEncodingException e1) {
throw new RuntimeException(e1);
}
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.