code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public static String decode(final String toDecode, final int relocate)
{
final StringBuffer sb = new StringBuffer();
final char[] encrypt = toDecode.toCharArray();
final int arraylength = encrypt.length;
for (int i = 0; i < arraylength; i++)
{
final char a = (char)(encrypt[i] - relocate);
sb.append(a);... | java |
public static String encode(final String secret, final int relocate)
{
final StringBuffer sb = new StringBuffer();
final char[] encrypt = secret.toCharArray();
final int arraylength = encrypt.length;
for (int i = 0; i < arraylength; i++)
{
final char a = (char)(encrypt[i] + relocate);
sb.append(a);
}... | java |
public static PublicKey readPemPublicKey(final File file) throws IOException,
NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException
{
final String publicKeyAsString = readPemFileAsBase64(file);
final byte[] decoded = Base64.decodeBase64(publicKeyAsString);
return readPublicKey(decoded);
} | java |
public static String toPemFormat(final PublicKey publicKey)
{
final String publicKeyAsBase64String = toBase64(publicKey);
final List<String> parts = StringExtensions.splitByFixedLength(publicKeyAsBase64String, 64);
final StringBuilder sb = new StringBuilder();
sb.append(PublicKeyReader.BEGIN_PUBLIC_KEY_PREFIX... | java |
protected void checkThreshold (final int nCount) throws IOException
{
if (!m_bThresholdExceeded && (m_nWritten + nCount > m_nThreshold))
{
m_bThresholdExceeded = true;
onThresholdReached ();
}
} | java |
@Nonnull
public ICommonsList <String> getHeaders (@Nullable final String sName)
{
return new CommonsArrayList <> (m_aHeaders.get (_unifyHeaderName (sName)));
} | java |
@Nonnull
public static EChange safeInvalidateSession (@Nullable final HttpSession aSession)
{
if (aSession != null)
{
try
{
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Invalidating session " + aSession.getId ());
aSession.invalidate ();
return EChange.CHANGED;
... | java |
@Nonnull
public static Enumeration <String> getAllAttributes (@Nonnull final HttpSession aSession)
{
ValueEnforcer.notNull (aSession, "Session");
try
{
return GenericReflection.uncheckedCast (aSession.getAttributeNames ());
}
catch (final IllegalStateException ex)
{
// Session n... | java |
@Nonnull
public IMicroDocument getAsDocument (@Nonnull @Nonempty final String sFullContextPath)
{
final String sNamespaceURL = CXMLSitemap.XML_NAMESPACE_0_9;
final IMicroDocument ret = new MicroDocument ();
final IMicroElement eSitemapindex = ret.appendElement (sNamespaceURL, ELEMENT_SITEMAPINDEX);
... | java |
@Nonnull
public static final <T extends AbstractSessionWebSingleton> T getSessionSingleton (@Nonnull final Class <T> aClass)
{
return getSingleton (_getStaticScope (true), aClass);
} | java |
@SuppressWarnings("unchecked")
public static boolean load(GLImplementation implementation) {
try {
final Constructor<?> constructor = Class.forName(implementation.getContextName()).getDeclaredConstructor();
constructor.setAccessible(true);
implementations.put(implementati... | java |
public void registerServlet (@Nonnull final Class <? extends Servlet> aServletClass,
@Nonnull @Nonempty final String sServletPath,
@Nonnull @Nonempty final String sServletName)
{
registerServlet (aServletClass, sServletPath, sServletName, (Map <String,... | java |
public void registerServlet (@Nonnull final Class <? extends Servlet> aServletClass,
@Nonnull @Nonempty final String sServletPath,
@Nonnull @Nonempty final String sServletName,
@Nullable final Map <String, String> aServletInitP... | java |
@Nullable
public Servlet getServletOfPath (@Nullable final String sPath)
{
final ICommonsList <ServletItem> aMatchingItems = new CommonsArrayList <> ();
if (StringHelper.hasText (sPath))
m_aServlets.findAll (aItem -> aItem.matchesPath (sPath), aMatchingItems::add);
final int nMatchingItems = aMatc... | java |
public void invalidate ()
{
if (m_bInvalidated)
throw new IllegalArgumentException ("Servlet pool already invalidated!");
m_bInvalidated = true;
// Destroy all servlets
for (final ServletItem aServletItem : m_aServlets)
try
{
aServletItem.getServlet ().destroy ();
}
... | java |
ReadIteratorResource<Read, ReadGroupSet, Reference> queryNextInterval() {
Stopwatch w = Stopwatch.createStarted();
if (!isAtEnd()) {
intervalIndex++;
}
if (isAtEnd()) {
return null;
}
ReadIteratorResource<Read, ReadGroupSet, Reference> result =
queryForInterval(currentInter... | java |
ReadIteratorResource<Read, ReadGroupSet, Reference> queryForInterval(GA4GHQueryInterval interval) {
try {
return dataSource.getReads(readSetId, interval.getSequence(),
interval.getStart(), interval.getEnd());
} catch (Exception ex) {
LOG.warning("Error getting data for interval " + ex.toSt... | java |
void seekMatchingRead() {
while (!isAtEnd()) {
if (iterator == null || !iterator.hasNext()) {
LOG.info("Getting " +
(iterator == null ? "first" : "next") +
" interval from the API");
// We have hit an end (or this is first time) so we need to go fish
// to th... | java |
@Nonnull
public CacheControlBuilder setMaxAge (@Nonnull final TimeUnit eTimeUnit, final long nDuration)
{
return setMaxAgeSeconds (eTimeUnit.toSeconds (nDuration));
} | java |
public boolean hasGroup(String groupName) {
boolean result = false;
for (Group item : getGroupsList()) {
if (item.getName().equals(groupName)) {
result = true;
}
}
return result;
} | java |
public Group getGroup(String groupName) {
Group result = null;
for (Group item : getGroupsList()) {
if (item.getName().equals(groupName)) {
result = item;
}
}
return result;
} | java |
protected void processDigits(List<Span> contextTokens, char compare, HashMap rule, int matchBegin, int currentPosition,
LinkedHashMap<String, ConTextSpan> matches) {
mt = pdigit.matcher(contextTokens.get(currentPosition).text);
if (mt.find()) {
double thisDig... | java |
public boolean matches(SAMRecord record) {
int myEnd = end == 0 ? Integer.MAX_VALUE : end;
switch (readPositionConstraint) {
case OVERLAPPING:
return CoordMath.overlaps(start, myEnd,
record.getAlignmentStart(), record.getAlignmentEnd());
case CONTAINED:
return CoordMath.... | java |
public static void clearContextPath ()
{
if (s_sServletContextPath != null)
{
if (LOGGER.isInfoEnabled () && !isSilentMode ())
LOGGER.info ("The servlet context path '" + s_sServletContextPath + "' was cleared!");
s_sServletContextPath = null;
}
if (s_sCustomContextPath != null)
... | java |
public final void setDataSource(DataSource dataSource) {
if (this.jdbcTemplate == null || dataSource != this.jdbcTemplate.getDataSource()) {
this.jdbcTemplate = createJdbcTemplate(dataSource);
initTemplateConfig();
}
} | java |
@Nullable
public static DigestAuthClientCredentials getDigestAuthClientCredentials (@Nullable final String sAuthHeader)
{
final ICommonsOrderedMap <String, String> aParams = getDigestAuthParams (sAuthHeader);
if (aParams == null)
return null;
final String sUserName = aParams.remove ("username");
... | java |
@Nonnull
public static DigestAuthClientCredentials createDigestAuthClientCredentials (@Nonnull final EHttpMethod eMethod,
@Nonnull @Nonempty final String sDigestURI,
... | java |
@SuppressWarnings("unchecked")
public <U extends Uniform> U get(String name) {
final Uniform uniform = uniforms.get(name);
if (uniform == null) {
return null;
}
return (U) uniform;
} | java |
@Nullable
private static String _getFilename (@Nullable final String sContentDisposition)
{
String sFilename = null;
if (sContentDisposition != null)
{
final String sContentDispositionLC = sContentDisposition.toLowerCase (Locale.US);
if (sContentDispositionLC.startsWith (RequestHelper.FORM_D... | java |
@Nullable
private static String _getFieldName (@Nullable final String sContentDisposition)
{
String sFieldName = null;
if (sContentDisposition != null && sContentDisposition.toLowerCase (Locale.US).startsWith (RequestHelper.FORM_DATA))
{
// Parameter parser can handle null input
final ICommo... | java |
public static boolean isForbiddenParamValueChar (final char c)
{
// INVALID_VALUE_CHAR_XML10 + 0x7f
return (c >= 0x0 && c <= 0x8) ||
(c >= 0xb && c <= 0xc) ||
(c >= 0xe && c <= 0x1f) ||
(c == 0x7f) ||
(c >= 0xd800 && c <= 0xdfff) ||
(c >= 0xfffe && c <= 0... | java |
@Nullable
public static String getWithoutForbiddenChars (@Nullable final String s)
{
if (s == null)
return null;
final StringBuilder aCleanValue = new StringBuilder (s.length ());
int nForbidden = 0;
for (final char c : s.toCharArray ())
if (isForbiddenParamValueChar (c))
nForb... | java |
public void setString(String string) {
rawString = string;
colorIndices.clear();
// Search for color codes
final StringBuilder stringBuilder = new StringBuilder(string);
final Matcher matcher = COLOR_PATTERN.matcher(string);
int removedCount = 0;
while (matcher.fi... | java |
public static PrivateKey readPrivateKey(final File root, final String directory,
final String fileName) throws NoSuchAlgorithmException, InvalidKeySpecException,
NoSuchProviderException, IOException
{
final File privatekeyDir = new File(root, directory);
final File privatekeyFile = new File(privatekeyDir, fil... | java |
protected String newAlgorithm()
{
if (getModel().getAlgorithm() == null)
{
return SunJCEAlgorithm.PBEWithMD5AndDES.getAlgorithm();
}
return getModel().getAlgorithm().getAlgorithm();
} | java |
@Override
public final void init (@Nonnull final ServletConfig aSC) throws ServletException
{
super.init (aSC);
m_aStatusMgr.onServletInit (getClass ());
try
{
// Build init parameter map
final ICommonsMap <String, String> aInitParams = new CommonsHashMap <> ();
final Enumeration <... | java |
@Override
public final void service (@Nonnull final ServletRequest req,
@Nonnull final ServletResponse res) throws ServletException, IOException
{
super.service (req, res);
} | java |
public static void beforeRequest (@Nonnull final HttpUriRequest aRequest, @Nullable final HttpContext aHttpContext)
{
if (isEnabled ())
if (LOGGER.isInfoEnabled ())
LOGGER.info ("Before HTTP call: " +
aRequest.getMethod () +
" " +
... | java |
public static void afterRequest (@Nonnull final HttpUriRequest aRequest,
@Nullable final Object aResponse,
@Nullable final Throwable aCaughtException)
{
if (isEnabled ())
if (LOGGER.isInfoEnabled ())
{
final HttpResponseExce... | java |
private void transform(JSONArray root) {
for (int i = 0, size = root.size(); i < size; i++)
{
Object target = root.get(i);
if (target instanceof JSONObject)
this.transform((JSONObject)target);
}
} | java |
public String hashAndHexPassword(final String password, final String salt)
throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException,
NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException,
InvalidKeySpecException, InvalidAlgorithmParameterException
{
return hashAndHexP... | java |
public String hashAndHexPassword(final String password, final String salt,
final HashAlgorithm hashAlgorithm, final Charset charset)
throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException,
NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException,
InvalidKeySpecException... | java |
public String hashPassword(final String password, final String salt,
final HashAlgorithm hashAlgorithm, final Charset charset) throws NoSuchAlgorithmException
{
final String hashedPassword = HashExtensions.hash(password, salt, hashAlgorithm, charset);
return hashedPassword;
} | java |
@Nonnull
public static final <T extends AbstractGlobalWebSingleton> T getGlobalSingleton (@Nonnull final Class <T> aClass)
{
return getSingleton (_getStaticScope (true), aClass);
} | java |
public static void setDNSCacheTime (final int nSeconds)
{
final String sValue = Integer.toString (nSeconds);
Security.setProperty ("networkaddress.cache.ttl", sValue);
Security.setProperty ("networkaddress.cache.negative.ttl", sValue);
SystemProperties.setPropertyValue ("disableWSAddressCaching", nSec... | java |
@Nonnull
public QValue getQValueOfCharset (@Nonnull final String sCharset)
{
ValueEnforcer.notNull (sCharset, "Charset");
// Find charset direct
QValue aQuality = m_aMap.get (_unify (sCharset));
if (aQuality == null)
{
// If not explicitly given, check for "*"
aQuality = m_aMap.get ... | java |
public static void checkForGLError() {
if (CausticUtil.isDebugEnabled()) {
final int errorValue = GL11.glGetError();
if (errorValue != GL11.GL_NO_ERROR) {
throw new GLException("GL ERROR: " + GLU.gluErrorString(errorValue));
}
}
} | java |
public static PemObject getPemObject(final File file) throws IOException
{
PemObject pemObject;
try (PemReader pemReader = new PemReader(new InputStreamReader(new FileInputStream(file))))
{
pemObject = pemReader.readPemObject();
}
return pemObject;
} | java |
public void clearAttributes ()
{
for (final Map.Entry <String, Object> entry : m_aAttributes.entrySet ())
{
final String sName = entry.getKey ();
final Object aValue = entry.getValue ();
if (aValue instanceof HttpSessionBindingListener)
((HttpSessionBindingListener) aValue).valueUnbo... | java |
@Nonnull
public Serializable serializeState ()
{
final ICommonsMap <String, Object> aState = new CommonsHashMap <> ();
for (final Map.Entry <String, Object> entry : m_aAttributes.entrySet ())
{
final String sName = entry.getKey ();
final Object aValue = entry.getValue ();
if (aValue in... | java |
@Nonnull
public static EChange setAll (final boolean bResponseCompressionEnabled,
final boolean bResponseGzipEnabled,
final boolean bResponseDeflateEnabled)
{
return s_aRWLock.writeLocked ( () -> {
EChange eChange = EChange.UNCHANGED;
i... | java |
@Nonnull
public static EChange setExpirationSeconds (final int nExpirationSeconds)
{
return s_aRWLock.writeLocked ( () -> {
if (s_nExpirationSeconds == nExpirationSeconds)
return EChange.UNCHANGED;
s_nExpirationSeconds = nExpirationSeconds;
LOGGER.info ("ResponseHelper expirationSecond... | java |
@Nonnull
public InputStream openStream () throws IOException
{
if (m_aIS instanceof ICloseable && ((ICloseable) m_aIS).isClosed ())
throw new MultipartItemSkippedException ();
return m_aIS;
} | java |
public @Nonnull String text() {
return new NodeListSpliterator(node.getChildNodes()).stream()
.filter(it -> it instanceof Text)
.map(it -> ((Text) it).getNodeValue())
.collect(joining());
} | java |
public @Nonnull Map<String, String> attr() {
synchronized (this) {
if (attrMap.get() == null) {
attrMap.set(
Optional.ofNullable(node.getAttributes())
.map(XQuery::attributesToMap)
.map(Collections::unmodifiableMap)
... | java |
private @Nonnull NodeList evaluate(String xpath) {
try {
XPathExpression expr = xpf.newXPath().compile(xpath);
return (NodeList) expr.evaluate(node, XPathConstants.NODESET);
} catch (XPathExpressionException ex) {
throw new IllegalArgumentException("Invalid XPath '" +... | java |
private @Nonnull Optional<XQuery> findElement(Function<Node, Node> iterator) {
Node it = node;
do {
it = iterator.apply(it);
} while (it != null && !(it instanceof Element));
return Optional.ofNullable(it).map(XQuery::new);
} | java |
@Nonnull
public DigestAuthServerBuilder setOpaque (@Nonnull final String sOpaque)
{
if (!HttpStringHelper.isQuotedTextContent (sOpaque))
throw new IllegalArgumentException ("opaque is invalid: " + sOpaque);
m_sOpaque = sOpaque;
return this;
} | java |
@Nonnull
public static String getRequestPathInfo (@Nullable final HttpServletRequest aRequest)
{
String ret = null;
if (aRequest != null)
try
{
// They may return null!
if (aRequest.isAsyncSupported () && aRequest.isAsyncStarted ())
ret = (String) aRequest.getAttribute ... | java |
@Nonnull
public static String getRequestRequestURI (@Nullable final HttpServletRequest aRequest)
{
String ret = "";
if (aRequest != null)
try
{
if (aRequest.isAsyncSupported () && aRequest.isAsyncStarted ())
ret = (String) aRequest.getAttribute (AsyncContext.ASYNC_REQUEST_URI);... | java |
@Nonnull
public static StringBuffer getRequestRequestURL (@Nullable final HttpServletRequest aRequest)
{
StringBuffer ret = null;
if (aRequest != null)
try
{
ret = aRequest.getRequestURL ();
}
catch (final Exception ex)
{
// fall through
if (isLogExcepti... | java |
@Nonnull
public static String getRequestServletPath (@Nullable final HttpServletRequest aRequest)
{
String ret = "";
if (aRequest != null)
try
{
if (aRequest.isAsyncSupported () && aRequest.isAsyncStarted ())
ret = (String) aRequest.getAttribute (AsyncContext.ASYNC_SERVLET_PATH... | java |
@Nonnull
public BasicAuthServerBuilder setRealm (@Nonnull final String sRealm)
{
ValueEnforcer.isTrue (HttpStringHelper.isQuotedTextContent (sRealm), () -> "Realm is invalid: " + sRealm);
m_sRealm = sRealm;
return this;
} | java |
public boolean contains(String path) {
boolean result = false;
FileName fn = new FileName(path);
if (fn.getPath().startsWith(getPath())) {
result = true;
}
return result;
} | java |
public String getCurrentAttempt()
{
if (currentIndex < words.size())
{
final String currentAttempt = words.get(currentIndex);
return currentAttempt;
}
return null;
} | java |
public boolean process()
{
boolean continueIterate = true;
boolean found = false;
String attempt = getCurrentAttempt();
while (continueIterate)
{
if (attempt.equals(toCheckAgainst))
{
found = true;
break;
}
attempt = getCurrentAttempt();
continueIterate = increment();
}
return foun... | java |
@Nullable
public FailedMailData remove (@Nullable final String sID)
{
if (StringHelper.hasNoText (sID))
return null;
return m_aRWLock.writeLocked ( () -> internalRemove (sID));
} | java |
@Nullable
public static BasicAuthClientCredentials getBasicAuthClientCredentials (@Nullable final String sAuthHeader)
{
final String sRealHeader = StringHelper.trim (sAuthHeader);
if (StringHelper.hasNoText (sRealHeader))
return null;
final String [] aElements = RegExHelper.getSplitToArray (sReal... | java |
public void onServletInit (@Nonnull final Class <? extends GenericServlet> aServletClass)
{
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("onServletInit: " + aServletClass);
_updateStatus (aServletClass, EServletStatus.INITED);
} | java |
public void onServletInvocation (@Nonnull final Class <? extends GenericServlet> aServletClass)
{
m_aRWLock.writeLocked ( () -> _getOrCreateServletStatus (aServletClass).internalIncrementInvocationCount ());
} | java |
@Nonnull
public static ENetworkPortStatus checkPortOpen (@Nonnull @Nonempty final String sHostName,
@Nonnegative final int nPort,
@Nonnegative final int nTimeoutMillisecs)
{
ValueEnforcer.notEmpty (sHostName, "Ho... | java |
@Nonnull
private static UserAgentElementList _decryptUserAgent (@Nonnull final String sUserAgent)
{
final UserAgentElementList ret = new UserAgentElementList ();
final StringScanner aSS = new StringScanner (sUserAgent.trim ());
while (true)
{
aSS.skipWhitespaces ();
final int nIndex = aS... | java |
@Nonnull
public static IUserAgent decryptUserAgentString (@Nonnull final String sUserAgent)
{
ValueEnforcer.notNull (sUserAgent, "UserAgent");
String sRealUserAgent = sUserAgent;
// Check if surrounded with '"' or '''
if (sRealUserAgent.length () >= 2)
{
final char cFirst = sRealUserAgen... | java |
@Nullable
public static PasswordAuthentication requestProxyPasswordAuthentication (@Nullable final String sHostName,
@Nullable final int nPort,
@Nullable final String s... | java |
public static <T> T get(final Class<T> pageClass, final String... params) {
cryIfNotAnnotated(pageClass);
try {
final String pageUrl = pageClass.getAnnotation(Page.class).value();
return loadPage(pageUrl, pageClass, Arrays.asList(params));
} catch (final Exception e) {
... | java |
@Nullable
private ICommonsOrderedMap <String, RequestParamMapItem> _getChildMapExceptLast (@Nonnull @Nonempty final String... aPath)
{
ValueEnforcer.notEmpty (aPath, "Path");
ICommonsOrderedMap <String, RequestParamMapItem> aMap = m_aMap;
// Until the second last object
for (int i = 0; i < aPath.le... | java |
@Nonnull
@Nonempty
@Deprecated
public static String getFieldName (@Nonnull @Nonempty final String sBaseName)
{
ValueEnforcer.notEmpty (sBaseName, "BaseName");
return sBaseName;
} | java |
public static void setSeparators (final char cOpen, final char cClose)
{
ValueEnforcer.isFalse (cOpen == cClose, "Open and closing element may not be identical!");
s_sOpen = Character.toString (cOpen);
s_sClose = Character.toString (cClose);
} | java |
public static void setSeparators (@Nonnull @Nonempty final String sOpen, @Nonnull @Nonempty final String sClose)
{
ValueEnforcer.notEmpty (sOpen, "Open");
ValueEnforcer.notEmpty (sClose, "Close");
ValueEnforcer.isFalse (sOpen.contains (sClose), "open may not contain close");
ValueEnforcer.isFalse (sCl... | java |
@Nonnull
public static SimpleURL getWithoutSessionID (@Nonnull final ISimpleURL aURL)
{
ValueEnforcer.notNull (aURL, "URL");
// Strip the parameter from the path, but keep parameters and anchor intact!
// Note: using URLData avoid parsing, since the data was already parsed!
return new SimpleURL (new... | java |
@Nonnull
public static String getPathWithinServletContext (@Nonnull final HttpServletRequest aHttpRequest)
{
ValueEnforcer.notNull (aHttpRequest, "HttpRequest");
final String sRequestURI = getRequestURI (aHttpRequest);
if (StringHelper.hasNoText (sRequestURI))
{
// Can e.g. happen for "Reques... | java |
@Nullable
public static EHttpVersion getHttpVersion (@Nonnull final HttpServletRequest aHttpRequest)
{
ValueEnforcer.notNull (aHttpRequest, "HttpRequest");
final String sProtocol = aHttpRequest.getProtocol ();
return EHttpVersion.getFromNameOrNull (sProtocol);
} | java |
@Nullable
public static EHttpMethod getHttpMethod (@Nonnull final HttpServletRequest aHttpRequest)
{
ValueEnforcer.notNull (aHttpRequest, "HttpRequest");
final String sMethod = aHttpRequest.getMethod ();
return EHttpMethod.getFromNameOrNull (sMethod);
} | java |
@Nonnull
@ReturnsMutableCopy
public static HttpHeaderMap getRequestHeaderMap (@Nonnull final HttpServletRequest aHttpRequest)
{
ValueEnforcer.notNull (aHttpRequest, "HttpRequest");
final HttpHeaderMap ret = new HttpHeaderMap ();
final Enumeration <String> aHeaders = aHttpRequest.getHeaderNames ();
... | java |
@Nullable
public static X509Certificate [] getRequestClientCertificates (@Nonnull final HttpServletRequest aHttpRequest)
{
return _getRequestAttr (aHttpRequest, SERVLET_ATTR_CLIENT_CERTIFICATE, X509Certificate [].class);
} | java |
@Nullable
public static String getHttpUserAgentStringFromRequest (@Nonnull final HttpServletRequest aHttpRequest)
{
// Use non-standard headers first
String sUserAgent = aHttpRequest.getHeader (CHttpHeader.UA);
if (sUserAgent == null)
{
sUserAgent = aHttpRequest.getHeader (CHttpHeader.X_DEVICE... | java |
@Nonnull
@Nonempty
public static String getCheckBoxHiddenFieldName (@Nonnull @Nonempty final String sFieldName)
{
ValueEnforcer.notEmpty (sFieldName, "FieldName");
return DEFAULT_CHECKBOX_HIDDEN_FIELD_PREFIX + sFieldName;
} | java |
@Nonnull
public static Cookie createCookie (@Nonnull final String sName,
@Nullable final String sValue,
final String sPath,
final boolean bExpireWhenBrowserIsClosed)
{
final Cookie aCookie = new Cookie... | java |
public static void removeCookie (@Nonnull final HttpServletResponse aHttpResponse, @Nonnull final Cookie aCookie)
{
ValueEnforcer.notNull (aHttpResponse, "HttpResponse");
ValueEnforcer.notNull (aCookie, "aCookie");
// expire the cookie!
aCookie.setMaxAge (0);
aHttpResponse.addCookie (aCookie);
... | java |
public static PrivateKey readPasswordProtectedPrivateKey(final byte[] encryptedPrivateKeyBytes,
final String password, final String algorithm)
throws IOException, NoSuchAlgorithmException, NoSuchPaddingException,
InvalidKeySpecException, InvalidKeyException, InvalidAlgorithmParameterException
{
final Encrypted... | java |
@Nonnull
public static ServletAsyncSpec createAsync (@CheckForSigned final long nTimeoutMillis,
@Nullable final Iterable <? extends AsyncListener> aAsyncListeners)
{
return new ServletAsyncSpec (true, nTimeoutMillis, aAsyncListeners);
} | java |
protected OutputStream initOutput(final File file)
throws MojoExecutionException {
// stream to return
final OutputStream stream;
// plenty of things can go wrong...
try {
// directory?
if (file.isDirectory()) {
throw new MojoExecutionException... | java |
protected InputStream initInput(final File file)
throws MojoExecutionException {
InputStream stream = null;
try {
if (file.isDirectory()) {
throw new MojoExecutionException("File "
+ file.getAbsolutePath()
+ " is directory!");
... | java |
protected void appendStream(final InputStream input,
final OutputStream output) throws MojoExecutionException {
// prebuffer
int character;
try {
// get line seperator, based on system
final String newLine = System.getProperty("line.separator");
// rea... | java |
@Override
protected void onThresholdReached () throws IOException
{
FileOutputStream aFOS = null;
try
{
aFOS = new FileOutputStream (m_aOutputFile);
m_aMemoryOS.writeTo (aFOS);
m_aCurrentOS = aFOS;
// Explicitly close the stream (even though this is a no-op)
StreamHelper.c... | java |
public void writeTo (@Nonnull @WillNotClose final OutputStream aOS) throws IOException
{
// we may only need to check if this is closed if we are working with a file
// but we should force the habit of closing whether we are working with
// a file or memory.
if (!m_bClosed)
throw new IOException... | java |
public static VertexData generatePlane(Vector2f size) {
final VertexData destination = new VertexData();
final VertexAttribute positionsAttribute = new VertexAttribute("positions", DataType.FLOAT, 3);
destination.addAttribute(0, positionsAttribute);
final TFloatList positions = new TFloa... | java |
public static void generatePlane(TFloatList positions, TFloatList normals, TFloatList textureCoords, TIntList indices, Vector2f size) {
/*
* 2-----3
* | |
* | |
* 0-----1
*/
// Corner positions
final Vector2f p = size.div(2);
final Vec... | java |
public static void generateCylinder(TFloatList positions, TFloatList normals, TIntList indices, float radius, float height) {
// 0,0,0 will be halfway up the cylinder in the middle
final float halfHeight = height / 2;
// The positions at the rims of the cylinders
final List<Vector3f> rim... | java |
@Nonnull
public EChange setFrom (@Nonnull final MockEventListenerList aList)
{
ValueEnforcer.notNull (aList, "List");
// Assigning this to this?
if (this == aList)
return EChange.UNCHANGED;
// Get all listeners to assign
final ICommonsList <EventListener> aOtherListeners = aList.getAllLi... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.