id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
136,700 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/version/Version.java | Version.parse | @Nonnull
public static Version parse (@Nullable final String sVersionString, final boolean bOldVersion)
{
final String s = sVersionString == null ? "" : sVersionString.trim ();
if (s.length () == 0)
return DEFAULT_VERSION;
int nMajor;
int nMinor;
int nMicro;
String sQualifier;
if (bOldVersion)
{
// old version
// split each token
final String [] aParts = StringHelper.getExplodedArray ('.', s, 4);
if (aParts.length > 0)
nMajor = StringParser.parseInt (aParts[0], 0);
else
nMajor = 0;
if (aParts.length > 1)
nMinor = StringParser.parseInt (aParts[1], 0);
else
nMinor = 0;
if (aParts.length > 2)
nMicro = StringParser.parseInt (aParts[2], 0);
else
nMicro = 0;
if (aParts.length > 3)
sQualifier = StringHelper.hasNoText (aParts[3]) ? null : aParts[3];
else
sQualifier = null;
}
else
{
// Complex parsing
Integer aMajor;
Integer aMinor = null;
Integer aMicro = null;
boolean bDone = false;
// Extract major version number
String [] aParts = _extSplit (s);
aMajor = StringParser.parseIntObj (aParts[0]);
if (aMajor == null && StringHelper.hasText (aParts[0]))
{
// Major version is not numeric, so everything is the qualifier
sQualifier = s;
bDone = true;
}
else
sQualifier = null;
String sRest = !bDone && aParts.length > 1 ? aParts[1] : null;
if (StringHelper.hasText (sRest))
{
// Parse minor version number part
aParts = _extSplit (sRest);
aMinor = StringParser.parseIntObj (aParts[0]);
if (aMinor == null && StringHelper.hasText (aParts[0]))
{
// Minor version is not numeric, so everything is the qualifier
sQualifier = sRest;
bDone = true;
}
sRest = !bDone && aParts.length > 1 ? aParts[1] : null;
if (StringHelper.hasText (sRest))
{
// Parse micro version number part
aParts = _extSplit (sRest);
aMicro = StringParser.parseIntObj (aParts[0]);
if (aMicro == null && StringHelper.hasText (aParts[0]))
{
// Micro version is not numeric, so everything is the qualifier
sQualifier = sRest;
bDone = true;
}
if (!bDone && aParts.length > 1)
{
// Some qualifier left!
sQualifier = aParts[1];
}
}
}
nMajor = aMajor == null ? 0 : aMajor.intValue ();
nMinor = aMinor == null ? 0 : aMinor.intValue ();
nMicro = aMicro == null ? 0 : aMicro.intValue ();
sQualifier = StringHelper.hasNoText (sQualifier) ? null : sQualifier;
}
return new Version (nMajor, nMinor, nMicro, sQualifier);
} | java | @Nonnull
public static Version parse (@Nullable final String sVersionString, final boolean bOldVersion)
{
final String s = sVersionString == null ? "" : sVersionString.trim ();
if (s.length () == 0)
return DEFAULT_VERSION;
int nMajor;
int nMinor;
int nMicro;
String sQualifier;
if (bOldVersion)
{
// old version
// split each token
final String [] aParts = StringHelper.getExplodedArray ('.', s, 4);
if (aParts.length > 0)
nMajor = StringParser.parseInt (aParts[0], 0);
else
nMajor = 0;
if (aParts.length > 1)
nMinor = StringParser.parseInt (aParts[1], 0);
else
nMinor = 0;
if (aParts.length > 2)
nMicro = StringParser.parseInt (aParts[2], 0);
else
nMicro = 0;
if (aParts.length > 3)
sQualifier = StringHelper.hasNoText (aParts[3]) ? null : aParts[3];
else
sQualifier = null;
}
else
{
// Complex parsing
Integer aMajor;
Integer aMinor = null;
Integer aMicro = null;
boolean bDone = false;
// Extract major version number
String [] aParts = _extSplit (s);
aMajor = StringParser.parseIntObj (aParts[0]);
if (aMajor == null && StringHelper.hasText (aParts[0]))
{
// Major version is not numeric, so everything is the qualifier
sQualifier = s;
bDone = true;
}
else
sQualifier = null;
String sRest = !bDone && aParts.length > 1 ? aParts[1] : null;
if (StringHelper.hasText (sRest))
{
// Parse minor version number part
aParts = _extSplit (sRest);
aMinor = StringParser.parseIntObj (aParts[0]);
if (aMinor == null && StringHelper.hasText (aParts[0]))
{
// Minor version is not numeric, so everything is the qualifier
sQualifier = sRest;
bDone = true;
}
sRest = !bDone && aParts.length > 1 ? aParts[1] : null;
if (StringHelper.hasText (sRest))
{
// Parse micro version number part
aParts = _extSplit (sRest);
aMicro = StringParser.parseIntObj (aParts[0]);
if (aMicro == null && StringHelper.hasText (aParts[0]))
{
// Micro version is not numeric, so everything is the qualifier
sQualifier = sRest;
bDone = true;
}
if (!bDone && aParts.length > 1)
{
// Some qualifier left!
sQualifier = aParts[1];
}
}
}
nMajor = aMajor == null ? 0 : aMajor.intValue ();
nMinor = aMinor == null ? 0 : aMinor.intValue ();
nMicro = aMicro == null ? 0 : aMicro.intValue ();
sQualifier = StringHelper.hasNoText (sQualifier) ? null : sQualifier;
}
return new Version (nMajor, nMinor, nMicro, sQualifier);
} | [
"@",
"Nonnull",
"public",
"static",
"Version",
"parse",
"(",
"@",
"Nullable",
"final",
"String",
"sVersionString",
",",
"final",
"boolean",
"bOldVersion",
")",
"{",
"final",
"String",
"s",
"=",
"sVersionString",
"==",
"null",
"?",
"\"\"",
":",
"sVersionString"... | Construct a version object from a string.
@param sVersionString
the version string to be interpreted as a version
@param bOldVersion
<code>true</code> to use the old version to parse a string, meaning
splitting only by dot; or <code>false</code> to indicate that the
more complex parsing should be used.
@return The parsed {@link Version} object.
@throws IllegalArgumentException
if any of the parameters is < 0 | [
"Construct",
"a",
"version",
"object",
"from",
"a",
"string",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/version/Version.java#L410-L506 |
136,701 | phax/ph-commons | ph-cli/src/main/java/com/helger/cli/HelpFormatter.java | HelpFormatter._appendOptionGroup | private void _appendOptionGroup (final StringBuilder aSB, final OptionGroup aGroup)
{
if (!aGroup.isRequired ())
aSB.append ('[');
final ICommonsList <Option> optList = aGroup.getAllOptions ();
if (m_aOptionComparator != null)
optList.sort (m_aOptionComparator);
// for each option in the OptionGroup
final Iterator <Option> it = optList.iterator ();
while (it.hasNext ())
{
// whether the option is required or not is handled at group level
_appendOption (aSB, it.next (), true);
if (it.hasNext ())
aSB.append (" | ");
}
if (!aGroup.isRequired ())
aSB.append (']');
} | java | private void _appendOptionGroup (final StringBuilder aSB, final OptionGroup aGroup)
{
if (!aGroup.isRequired ())
aSB.append ('[');
final ICommonsList <Option> optList = aGroup.getAllOptions ();
if (m_aOptionComparator != null)
optList.sort (m_aOptionComparator);
// for each option in the OptionGroup
final Iterator <Option> it = optList.iterator ();
while (it.hasNext ())
{
// whether the option is required or not is handled at group level
_appendOption (aSB, it.next (), true);
if (it.hasNext ())
aSB.append (" | ");
}
if (!aGroup.isRequired ())
aSB.append (']');
} | [
"private",
"void",
"_appendOptionGroup",
"(",
"final",
"StringBuilder",
"aSB",
",",
"final",
"OptionGroup",
"aGroup",
")",
"{",
"if",
"(",
"!",
"aGroup",
".",
"isRequired",
"(",
")",
")",
"aSB",
".",
"append",
"(",
"'",
"'",
")",
";",
"final",
"ICommonsL... | Appends the usage clause for an OptionGroup to a StringBuilder. The clause
is wrapped in square brackets if the group is required. The display of the
options is handled by appendOption
@param aSB
the StringBuilder to append to
@param aGroup
the group to append
@see #_appendOption(StringBuilder,Option,boolean) | [
"Appends",
"the",
"usage",
"clause",
"for",
"an",
"OptionGroup",
"to",
"a",
"StringBuilder",
".",
"The",
"clause",
"is",
"wrapped",
"in",
"square",
"brackets",
"if",
"the",
"group",
"is",
"required",
".",
"The",
"display",
"of",
"the",
"options",
"is",
"ha... | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-cli/src/main/java/com/helger/cli/HelpFormatter.java#L688-L710 |
136,702 | phax/ph-commons | ph-cli/src/main/java/com/helger/cli/HelpFormatter.java | HelpFormatter.printUsage | public void printUsage (@Nonnull final PrintWriter aPW, final int nWidth, final String sCmdLineSyntax)
{
final int nArgPos = sCmdLineSyntax.indexOf (' ') + 1;
printWrapped (aPW, nWidth, getSyntaxPrefix ().length () + nArgPos, getSyntaxPrefix () + sCmdLineSyntax);
} | java | public void printUsage (@Nonnull final PrintWriter aPW, final int nWidth, final String sCmdLineSyntax)
{
final int nArgPos = sCmdLineSyntax.indexOf (' ') + 1;
printWrapped (aPW, nWidth, getSyntaxPrefix ().length () + nArgPos, getSyntaxPrefix () + sCmdLineSyntax);
} | [
"public",
"void",
"printUsage",
"(",
"@",
"Nonnull",
"final",
"PrintWriter",
"aPW",
",",
"final",
"int",
"nWidth",
",",
"final",
"String",
"sCmdLineSyntax",
")",
"{",
"final",
"int",
"nArgPos",
"=",
"sCmdLineSyntax",
".",
"indexOf",
"(",
"'",
"'",
")",
"+"... | Print the sCmdLineSyntax to the specified writer, using the specified
width.
@param aPW
The printWriter to write the help to
@param nWidth
The number of characters per line for the usage statement.
@param sCmdLineSyntax
The usage statement. | [
"Print",
"the",
"sCmdLineSyntax",
"to",
"the",
"specified",
"writer",
"using",
"the",
"specified",
"width",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-cli/src/main/java/com/helger/cli/HelpFormatter.java#L755-L760 |
136,703 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mime/MimeTypeDeterminator.java | MimeTypeDeterminator.registerMimeTypeContent | @Nonnull
public EChange registerMimeTypeContent (@Nonnull final MimeTypeContent aMimeTypeContent)
{
ValueEnforcer.notNull (aMimeTypeContent, "MimeTypeContent");
return m_aRWLock.writeLocked ( () -> m_aMimeTypeContents.addObject (aMimeTypeContent));
} | java | @Nonnull
public EChange registerMimeTypeContent (@Nonnull final MimeTypeContent aMimeTypeContent)
{
ValueEnforcer.notNull (aMimeTypeContent, "MimeTypeContent");
return m_aRWLock.writeLocked ( () -> m_aMimeTypeContents.addObject (aMimeTypeContent));
} | [
"@",
"Nonnull",
"public",
"EChange",
"registerMimeTypeContent",
"(",
"@",
"Nonnull",
"final",
"MimeTypeContent",
"aMimeTypeContent",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aMimeTypeContent",
",",
"\"MimeTypeContent\"",
")",
";",
"return",
"m_aRWLock",
".",
... | Register a new MIME content type.
@param aMimeTypeContent
The content type to register. May not be <code>null</code>.
@return {@link EChange#CHANGED} if the object was successfully registered. | [
"Register",
"a",
"new",
"MIME",
"content",
"type",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mime/MimeTypeDeterminator.java#L144-L150 |
136,704 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mime/MimeTypeDeterminator.java | MimeTypeDeterminator.unregisterMimeTypeContent | @Nonnull
public EChange unregisterMimeTypeContent (@Nullable final MimeTypeContent aMimeTypeContent)
{
if (aMimeTypeContent == null)
return EChange.UNCHANGED;
return m_aRWLock.writeLocked ( () -> m_aMimeTypeContents.removeObject (aMimeTypeContent));
} | java | @Nonnull
public EChange unregisterMimeTypeContent (@Nullable final MimeTypeContent aMimeTypeContent)
{
if (aMimeTypeContent == null)
return EChange.UNCHANGED;
return m_aRWLock.writeLocked ( () -> m_aMimeTypeContents.removeObject (aMimeTypeContent));
} | [
"@",
"Nonnull",
"public",
"EChange",
"unregisterMimeTypeContent",
"(",
"@",
"Nullable",
"final",
"MimeTypeContent",
"aMimeTypeContent",
")",
"{",
"if",
"(",
"aMimeTypeContent",
"==",
"null",
")",
"return",
"EChange",
".",
"UNCHANGED",
";",
"return",
"m_aRWLock",
"... | Unregister an existing MIME content type.
@param aMimeTypeContent
The content type to unregister. May not be <code>null</code>.
@return {@link EChange#CHANGED} if the object was successfully
unregistered. | [
"Unregister",
"an",
"existing",
"MIME",
"content",
"type",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mime/MimeTypeDeterminator.java#L160-L167 |
136,705 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mime/MimeTypeDeterminator.java | MimeTypeDeterminator.getMimeTypeFromBytes | @Nullable
public IMimeType getMimeTypeFromBytes (@Nullable final byte [] aBytes, @Nullable final IMimeType aDefault)
{
if (aBytes == null || aBytes.length == 0)
return aDefault;
return m_aRWLock.readLocked ( () -> {
for (final MimeTypeContent aMTC : m_aMimeTypeContents)
if (aMTC.matchesBeginning (aBytes))
return aMTC.getMimeType ();
// default fallback
return aDefault;
});
} | java | @Nullable
public IMimeType getMimeTypeFromBytes (@Nullable final byte [] aBytes, @Nullable final IMimeType aDefault)
{
if (aBytes == null || aBytes.length == 0)
return aDefault;
return m_aRWLock.readLocked ( () -> {
for (final MimeTypeContent aMTC : m_aMimeTypeContents)
if (aMTC.matchesBeginning (aBytes))
return aMTC.getMimeType ();
// default fallback
return aDefault;
});
} | [
"@",
"Nullable",
"public",
"IMimeType",
"getMimeTypeFromBytes",
"(",
"@",
"Nullable",
"final",
"byte",
"[",
"]",
"aBytes",
",",
"@",
"Nullable",
"final",
"IMimeType",
"aDefault",
")",
"{",
"if",
"(",
"aBytes",
"==",
"null",
"||",
"aBytes",
".",
"length",
"... | Try to determine the MIME type from the given byte array.
@param aBytes
The byte array to parse. May be <code>null</code> or empty.
@param aDefault
The default MIME type to be returned, if no matching MIME type was
found. May be <code>null</code>.
@return The supplied default value, if no matching MIME type was found. May
be <code>null</code>. | [
"Try",
"to",
"determine",
"the",
"MIME",
"type",
"from",
"the",
"given",
"byte",
"array",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mime/MimeTypeDeterminator.java#L233-L247 |
136,706 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mime/MimeTypeDeterminator.java | MimeTypeDeterminator.reinitialize | public void reinitialize ()
{
m_aRWLock.writeLocked ( () -> {
m_aMimeTypeContents.clear ();
_registerDefaultMimeTypeContents ();
});
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Reinitialized " + MimeTypeDeterminator.class.getName ());
} | java | public void reinitialize ()
{
m_aRWLock.writeLocked ( () -> {
m_aMimeTypeContents.clear ();
_registerDefaultMimeTypeContents ();
});
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Reinitialized " + MimeTypeDeterminator.class.getName ());
} | [
"public",
"void",
"reinitialize",
"(",
")",
"{",
"m_aRWLock",
".",
"writeLocked",
"(",
"(",
")",
"->",
"{",
"m_aMimeTypeContents",
".",
"clear",
"(",
")",
";",
"_registerDefaultMimeTypeContents",
"(",
")",
";",
"}",
")",
";",
"if",
"(",
"LOGGER",
".",
"i... | Reset the MimeTypeContent cache to the initial state.
@see #registerMimeTypeContent(MimeTypeContent)
@see #unregisterMimeTypeContent(MimeTypeContent) | [
"Reset",
"the",
"MimeTypeContent",
"cache",
"to",
"the",
"initial",
"state",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mime/MimeTypeDeterminator.java#L266-L275 |
136,707 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/math/CombinationGeneratorFlexible.java | CombinationGeneratorFlexible.iterateAllCombinations | public void iterateAllCombinations (@Nonnull final ICommonsList <DATATYPE> aElements,
@Nonnull final Consumer <? super ICommonsList <DATATYPE>> aCallback)
{
ValueEnforcer.notNull (aElements, "Elements");
ValueEnforcer.notNull (aCallback, "Callback");
for (int nSlotCount = m_bAllowEmpty ? 0 : 1; nSlotCount <= m_nSlotCount; nSlotCount++)
{
if (aElements.isEmpty ())
{
aCallback.accept (new CommonsArrayList <> ());
}
else
{
// Add all permutations for the current slot count
for (final ICommonsList <DATATYPE> aPermutation : new CombinationGenerator <> (aElements, nSlotCount))
aCallback.accept (aPermutation);
}
}
} | java | public void iterateAllCombinations (@Nonnull final ICommonsList <DATATYPE> aElements,
@Nonnull final Consumer <? super ICommonsList <DATATYPE>> aCallback)
{
ValueEnforcer.notNull (aElements, "Elements");
ValueEnforcer.notNull (aCallback, "Callback");
for (int nSlotCount = m_bAllowEmpty ? 0 : 1; nSlotCount <= m_nSlotCount; nSlotCount++)
{
if (aElements.isEmpty ())
{
aCallback.accept (new CommonsArrayList <> ());
}
else
{
// Add all permutations for the current slot count
for (final ICommonsList <DATATYPE> aPermutation : new CombinationGenerator <> (aElements, nSlotCount))
aCallback.accept (aPermutation);
}
}
} | [
"public",
"void",
"iterateAllCombinations",
"(",
"@",
"Nonnull",
"final",
"ICommonsList",
"<",
"DATATYPE",
">",
"aElements",
",",
"@",
"Nonnull",
"final",
"Consumer",
"<",
"?",
"super",
"ICommonsList",
"<",
"DATATYPE",
">",
">",
"aCallback",
")",
"{",
"ValueEn... | Iterate all combination, no matter they are unique or not.
@param aElements
List of elements.
@param aCallback
Callback to invoke | [
"Iterate",
"all",
"combination",
"no",
"matter",
"they",
"are",
"unique",
"or",
"not",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/math/CombinationGeneratorFlexible.java#L73-L92 |
136,708 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/math/CombinationGeneratorFlexible.java | CombinationGeneratorFlexible.getCombinations | @Nonnull
@ReturnsMutableCopy
public ICommonsSet <ICommonsList <DATATYPE>> getCombinations (@Nonnull final ICommonsList <DATATYPE> aElements)
{
ValueEnforcer.notNull (aElements, "Elements");
final ICommonsSet <ICommonsList <DATATYPE>> aAllResults = new CommonsHashSet <> ();
iterateAllCombinations (aElements, aAllResults::add);
return aAllResults;
} | java | @Nonnull
@ReturnsMutableCopy
public ICommonsSet <ICommonsList <DATATYPE>> getCombinations (@Nonnull final ICommonsList <DATATYPE> aElements)
{
ValueEnforcer.notNull (aElements, "Elements");
final ICommonsSet <ICommonsList <DATATYPE>> aAllResults = new CommonsHashSet <> ();
iterateAllCombinations (aElements, aAllResults::add);
return aAllResults;
} | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"ICommonsSet",
"<",
"ICommonsList",
"<",
"DATATYPE",
">",
">",
"getCombinations",
"(",
"@",
"Nonnull",
"final",
"ICommonsList",
"<",
"DATATYPE",
">",
"aElements",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"("... | Generate all combinations without duplicates.
@param aElements
the elements to distribute to the specified slots (may be empty!)
@return a set of slot allocations representing all possible combinations | [
"Generate",
"all",
"combinations",
"without",
"duplicates",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/math/CombinationGeneratorFlexible.java#L101-L110 |
136,709 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/collection/map/AbstractSoftMap.java | AbstractSoftMap._processQueue | private void _processQueue ()
{
SoftValue <K, V> aSoftValue;
while ((aSoftValue = GenericReflection.uncheckedCast (m_aQueue.poll ())) != null)
{
m_aSrcMap.remove (aSoftValue.m_aKey);
}
} | java | private void _processQueue ()
{
SoftValue <K, V> aSoftValue;
while ((aSoftValue = GenericReflection.uncheckedCast (m_aQueue.poll ())) != null)
{
m_aSrcMap.remove (aSoftValue.m_aKey);
}
} | [
"private",
"void",
"_processQueue",
"(",
")",
"{",
"SoftValue",
"<",
"K",
",",
"V",
">",
"aSoftValue",
";",
"while",
"(",
"(",
"aSoftValue",
"=",
"GenericReflection",
".",
"uncheckedCast",
"(",
"m_aQueue",
".",
"poll",
"(",
")",
")",
")",
"!=",
"null",
... | Here we go through the ReferenceQueue and remove garbage collected
SoftValue objects from the HashMap by looking them up using the
SoftValue.m_aKey data member. | [
"Here",
"we",
"go",
"through",
"the",
"ReferenceQueue",
"and",
"remove",
"garbage",
"collected",
"SoftValue",
"objects",
"from",
"the",
"HashMap",
"by",
"looking",
"them",
"up",
"using",
"the",
"SoftValue",
".",
"m_aKey",
"data",
"member",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/map/AbstractSoftMap.java#L292-L299 |
136,710 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/collection/map/AbstractSoftMap.java | AbstractSoftMap.put | @Override
public V put (final K aKey, final V aValue)
{
// throw out garbage collected values first
_processQueue ();
final SoftValue <K, V> aOld = m_aSrcMap.put (aKey, new SoftValue <> (aKey, aValue, m_aQueue));
return aOld == null ? null : aOld.get ();
} | java | @Override
public V put (final K aKey, final V aValue)
{
// throw out garbage collected values first
_processQueue ();
final SoftValue <K, V> aOld = m_aSrcMap.put (aKey, new SoftValue <> (aKey, aValue, m_aQueue));
return aOld == null ? null : aOld.get ();
} | [
"@",
"Override",
"public",
"V",
"put",
"(",
"final",
"K",
"aKey",
",",
"final",
"V",
"aValue",
")",
"{",
"// throw out garbage collected values first",
"_processQueue",
"(",
")",
";",
"final",
"SoftValue",
"<",
"K",
",",
"V",
">",
"aOld",
"=",
"m_aSrcMap",
... | Here we put the key, value pair into the HashMap using a SoftValue object. | [
"Here",
"we",
"put",
"the",
"key",
"value",
"pair",
"into",
"the",
"HashMap",
"using",
"a",
"SoftValue",
"object",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/map/AbstractSoftMap.java#L304-L311 |
136,711 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingCharArrayWriter.java | NonBlockingCharArrayWriter.write | @Override
public void write (final int c)
{
final int nNewCount = m_nCount + 1;
if (nNewCount > m_aBuf.length)
m_aBuf = Arrays.copyOf (m_aBuf, Math.max (m_aBuf.length << 1, nNewCount));
m_aBuf[m_nCount] = (char) c;
m_nCount = nNewCount;
} | java | @Override
public void write (final int c)
{
final int nNewCount = m_nCount + 1;
if (nNewCount > m_aBuf.length)
m_aBuf = Arrays.copyOf (m_aBuf, Math.max (m_aBuf.length << 1, nNewCount));
m_aBuf[m_nCount] = (char) c;
m_nCount = nNewCount;
} | [
"@",
"Override",
"public",
"void",
"write",
"(",
"final",
"int",
"c",
")",
"{",
"final",
"int",
"nNewCount",
"=",
"m_nCount",
"+",
"1",
";",
"if",
"(",
"nNewCount",
">",
"m_aBuf",
".",
"length",
")",
"m_aBuf",
"=",
"Arrays",
".",
"copyOf",
"(",
"m_aB... | Writes a character to the buffer. | [
"Writes",
"a",
"character",
"to",
"the",
"buffer",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingCharArrayWriter.java#L80-L88 |
136,712 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingCharArrayWriter.java | NonBlockingCharArrayWriter.write | @Override
public void write (@Nonnull final char [] aBuf, @Nonnegative final int nOfs, @Nonnegative final int nLen)
{
ValueEnforcer.isArrayOfsLen (aBuf, nOfs, nLen);
if (nLen > 0)
{
final int nNewCount = m_nCount + nLen;
if (nNewCount > m_aBuf.length)
m_aBuf = Arrays.copyOf (m_aBuf, Math.max (m_aBuf.length << 1, nNewCount));
System.arraycopy (aBuf, nOfs, m_aBuf, m_nCount, nLen);
m_nCount = nNewCount;
}
} | java | @Override
public void write (@Nonnull final char [] aBuf, @Nonnegative final int nOfs, @Nonnegative final int nLen)
{
ValueEnforcer.isArrayOfsLen (aBuf, nOfs, nLen);
if (nLen > 0)
{
final int nNewCount = m_nCount + nLen;
if (nNewCount > m_aBuf.length)
m_aBuf = Arrays.copyOf (m_aBuf, Math.max (m_aBuf.length << 1, nNewCount));
System.arraycopy (aBuf, nOfs, m_aBuf, m_nCount, nLen);
m_nCount = nNewCount;
}
} | [
"@",
"Override",
"public",
"void",
"write",
"(",
"@",
"Nonnull",
"final",
"char",
"[",
"]",
"aBuf",
",",
"@",
"Nonnegative",
"final",
"int",
"nOfs",
",",
"@",
"Nonnegative",
"final",
"int",
"nLen",
")",
"{",
"ValueEnforcer",
".",
"isArrayOfsLen",
"(",
"a... | Writes characters to the buffer.
@param aBuf
the data to be written
@param nOfs
the start offset in the data
@param nLen
the number of chars that are written | [
"Writes",
"characters",
"to",
"the",
"buffer",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingCharArrayWriter.java#L100-L113 |
136,713 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingCharArrayWriter.java | NonBlockingCharArrayWriter.write | @Override
public void write (@Nonnull final String sStr, @Nonnegative final int nOfs, @Nonnegative final int nLen)
{
if (nLen > 0)
{
final int newcount = m_nCount + nLen;
if (newcount > m_aBuf.length)
{
m_aBuf = Arrays.copyOf (m_aBuf, Math.max (m_aBuf.length << 1, newcount));
}
sStr.getChars (nOfs, nOfs + nLen, m_aBuf, m_nCount);
m_nCount = newcount;
}
} | java | @Override
public void write (@Nonnull final String sStr, @Nonnegative final int nOfs, @Nonnegative final int nLen)
{
if (nLen > 0)
{
final int newcount = m_nCount + nLen;
if (newcount > m_aBuf.length)
{
m_aBuf = Arrays.copyOf (m_aBuf, Math.max (m_aBuf.length << 1, newcount));
}
sStr.getChars (nOfs, nOfs + nLen, m_aBuf, m_nCount);
m_nCount = newcount;
}
} | [
"@",
"Override",
"public",
"void",
"write",
"(",
"@",
"Nonnull",
"final",
"String",
"sStr",
",",
"@",
"Nonnegative",
"final",
"int",
"nOfs",
",",
"@",
"Nonnegative",
"final",
"int",
"nLen",
")",
"{",
"if",
"(",
"nLen",
">",
"0",
")",
"{",
"final",
"i... | Write a portion of a string to the buffer.
@param sStr
String to be written from
@param nOfs
Offset from which to start reading characters
@param nLen
Number of characters to be written | [
"Write",
"a",
"portion",
"of",
"a",
"string",
"to",
"the",
"buffer",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingCharArrayWriter.java#L125-L138 |
136,714 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingCharArrayWriter.java | NonBlockingCharArrayWriter.toByteArray | @Nonnull
@ReturnsMutableCopy
public byte [] toByteArray (@Nonnull final Charset aCharset)
{
return StringHelper.encodeCharToBytes (m_aBuf, 0, m_nCount, aCharset);
} | java | @Nonnull
@ReturnsMutableCopy
public byte [] toByteArray (@Nonnull final Charset aCharset)
{
return StringHelper.encodeCharToBytes (m_aBuf, 0, m_nCount, aCharset);
} | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"byte",
"[",
"]",
"toByteArray",
"(",
"@",
"Nonnull",
"final",
"Charset",
"aCharset",
")",
"{",
"return",
"StringHelper",
".",
"encodeCharToBytes",
"(",
"m_aBuf",
",",
"0",
",",
"m_nCount",
",",
"aCharset",
... | Returns a copy of the input data as bytes in the correct charset.
@param aCharset
The charset to be used. May not be <code>null</code>.
@return an array of bytes. Never <code>null</code>. | [
"Returns",
"a",
"copy",
"of",
"the",
"input",
"data",
"as",
"bytes",
"in",
"the",
"correct",
"charset",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingCharArrayWriter.java#L278-L283 |
136,715 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingCharArrayWriter.java | NonBlockingCharArrayWriter.getAsString | @Nonnull
public String getAsString (@Nonnegative final int nLength)
{
ValueEnforcer.isBetweenInclusive (nLength, "Length", 0, m_nCount);
return new String (m_aBuf, 0, nLength);
} | java | @Nonnull
public String getAsString (@Nonnegative final int nLength)
{
ValueEnforcer.isBetweenInclusive (nLength, "Length", 0, m_nCount);
return new String (m_aBuf, 0, nLength);
} | [
"@",
"Nonnull",
"public",
"String",
"getAsString",
"(",
"@",
"Nonnegative",
"final",
"int",
"nLength",
")",
"{",
"ValueEnforcer",
".",
"isBetweenInclusive",
"(",
"nLength",
",",
"\"Length\"",
",",
"0",
",",
"m_nCount",
")",
";",
"return",
"new",
"String",
"(... | Converts input data to a string.
@param nLength
The number of characters to convert. Must be ≤ than
{@link #getSize()}.
@return the string. | [
"Converts",
"input",
"data",
"to",
"a",
"string",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingCharArrayWriter.java#L350-L355 |
136,716 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/cache/Cache.java | Cache.createCache | @Nonnull
@ReturnsMutableCopy
@OverrideOnDemand
@CodingStyleguideUnaware
protected ICommonsMap <KEYTYPE, VALUETYPE> createCache ()
{
return hasMaxSize () ? new SoftLinkedHashMap <> (m_nMaxSize) : new SoftHashMap <> ();
} | java | @Nonnull
@ReturnsMutableCopy
@OverrideOnDemand
@CodingStyleguideUnaware
protected ICommonsMap <KEYTYPE, VALUETYPE> createCache ()
{
return hasMaxSize () ? new SoftLinkedHashMap <> (m_nMaxSize) : new SoftHashMap <> ();
} | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"@",
"OverrideOnDemand",
"@",
"CodingStyleguideUnaware",
"protected",
"ICommonsMap",
"<",
"KEYTYPE",
",",
"VALUETYPE",
">",
"createCache",
"(",
")",
"{",
"return",
"hasMaxSize",
"(",
")",
"?",
"new",
"SoftLinkedHashMap",
... | Create a new cache map. This is the internal map that is used to store the
items.
@return Never <code>null</code>. | [
"Create",
"a",
"new",
"cache",
"map",
".",
"This",
"is",
"the",
"internal",
"map",
"that",
"is",
"used",
"to",
"store",
"the",
"items",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/cache/Cache.java#L123-L130 |
136,717 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/cache/Cache.java | Cache.getFromCache | public VALUETYPE getFromCache (final KEYTYPE aKey)
{
VALUETYPE aValue = getFromCacheNoStats (aKey);
if (aValue == null)
{
// No old value in the cache
m_aRWLock.writeLock ().lock ();
try
{
// Read again, in case the value was set between the two locking
// sections
// Note: do not increase statistics in this second try
aValue = getFromCacheNoStatsNotLocked (aKey);
if (aValue == null)
{
// Call the abstract method to create the value to cache
aValue = m_aCacheValueProvider.apply (aKey);
// Just a consistency check
if (aValue == null)
throw new IllegalStateException ("The value to cache was null for key '" + aKey + "'");
// Put the new value into the cache
putInCacheNotLocked (aKey, aValue);
m_aCacheAccessStats.cacheMiss ();
}
else
m_aCacheAccessStats.cacheHit ();
}
finally
{
m_aRWLock.writeLock ().unlock ();
}
}
else
m_aCacheAccessStats.cacheHit ();
return aValue;
} | java | public VALUETYPE getFromCache (final KEYTYPE aKey)
{
VALUETYPE aValue = getFromCacheNoStats (aKey);
if (aValue == null)
{
// No old value in the cache
m_aRWLock.writeLock ().lock ();
try
{
// Read again, in case the value was set between the two locking
// sections
// Note: do not increase statistics in this second try
aValue = getFromCacheNoStatsNotLocked (aKey);
if (aValue == null)
{
// Call the abstract method to create the value to cache
aValue = m_aCacheValueProvider.apply (aKey);
// Just a consistency check
if (aValue == null)
throw new IllegalStateException ("The value to cache was null for key '" + aKey + "'");
// Put the new value into the cache
putInCacheNotLocked (aKey, aValue);
m_aCacheAccessStats.cacheMiss ();
}
else
m_aCacheAccessStats.cacheHit ();
}
finally
{
m_aRWLock.writeLock ().unlock ();
}
}
else
m_aCacheAccessStats.cacheHit ();
return aValue;
} | [
"public",
"VALUETYPE",
"getFromCache",
"(",
"final",
"KEYTYPE",
"aKey",
")",
"{",
"VALUETYPE",
"aValue",
"=",
"getFromCacheNoStats",
"(",
"aKey",
")",
";",
"if",
"(",
"aValue",
"==",
"null",
")",
"{",
"// No old value in the cache",
"m_aRWLock",
".",
"writeLock"... | Here Nonnull but derived class may be Nullable | [
"Here",
"Nonnull",
"but",
"derived",
"class",
"may",
"be",
"Nullable"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/cache/Cache.java#L190-L227 |
136,718 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java | ByteBufferOutputStream.getAsByteArray | @Nonnull
@ReturnsMutableCopy
public byte [] getAsByteArray ()
{
final byte [] aArray = m_aBuffer.array ();
final int nOfs = m_aBuffer.arrayOffset ();
final int nLength = m_aBuffer.position ();
return ArrayHelper.getCopy (aArray, nOfs, nLength);
} | java | @Nonnull
@ReturnsMutableCopy
public byte [] getAsByteArray ()
{
final byte [] aArray = m_aBuffer.array ();
final int nOfs = m_aBuffer.arrayOffset ();
final int nLength = m_aBuffer.position ();
return ArrayHelper.getCopy (aArray, nOfs, nLength);
} | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"byte",
"[",
"]",
"getAsByteArray",
"(",
")",
"{",
"final",
"byte",
"[",
"]",
"aArray",
"=",
"m_aBuffer",
".",
"array",
"(",
")",
";",
"final",
"int",
"nOfs",
"=",
"m_aBuffer",
".",
"arrayOffset",
"(",... | Get everything as a big byte array, without altering the ByteBuffer. This
works only if the contained ByteBuffer has a backing array.
@return The content of the buffer as a byte array. Never <code>null</code>. | [
"Get",
"everything",
"as",
"a",
"big",
"byte",
"array",
"without",
"altering",
"the",
"ByteBuffer",
".",
"This",
"works",
"only",
"if",
"the",
"contained",
"ByteBuffer",
"has",
"a",
"backing",
"array",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java#L174-L183 |
136,719 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java | ByteBufferOutputStream.writeTo | public void writeTo (@Nonnull @WillNotClose final OutputStream aOS, final boolean bClearBuffer) throws IOException
{
ValueEnforcer.notNull (aOS, "OutputStream");
aOS.write (m_aBuffer.array (), m_aBuffer.arrayOffset (), m_aBuffer.position ());
if (bClearBuffer)
m_aBuffer.clear ();
} | java | public void writeTo (@Nonnull @WillNotClose final OutputStream aOS, final boolean bClearBuffer) throws IOException
{
ValueEnforcer.notNull (aOS, "OutputStream");
aOS.write (m_aBuffer.array (), m_aBuffer.arrayOffset (), m_aBuffer.position ());
if (bClearBuffer)
m_aBuffer.clear ();
} | [
"public",
"void",
"writeTo",
"(",
"@",
"Nonnull",
"@",
"WillNotClose",
"final",
"OutputStream",
"aOS",
",",
"final",
"boolean",
"bClearBuffer",
")",
"throws",
"IOException",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aOS",
",",
"\"OutputStream\"",
")",
";",
"... | Write everything to the passed output stream and optionally clear the
contained buffer. This works only if the contained ByteBuffer has a backing
array.
@param aOS
The output stream to write to. May not be <code>null</code>.
@param bClearBuffer
<code>true</code> to clear the buffer, <code>false</code> to not do
it. If <code>false</code> you may call {@link #reset()} to clear it
manually afterwards.
@throws IOException
In case of IO error | [
"Write",
"everything",
"to",
"the",
"passed",
"output",
"stream",
"and",
"optionally",
"clear",
"the",
"contained",
"buffer",
".",
"This",
"works",
"only",
"if",
"the",
"contained",
"ByteBuffer",
"has",
"a",
"backing",
"array",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java#L341-L348 |
136,720 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java | ByteBufferOutputStream.getAsString | @Nonnull
public String getAsString (@Nonnull final Charset aCharset)
{
return new String (m_aBuffer.array (), m_aBuffer.arrayOffset (), m_aBuffer.position (), aCharset);
} | java | @Nonnull
public String getAsString (@Nonnull final Charset aCharset)
{
return new String (m_aBuffer.array (), m_aBuffer.arrayOffset (), m_aBuffer.position (), aCharset);
} | [
"@",
"Nonnull",
"public",
"String",
"getAsString",
"(",
"@",
"Nonnull",
"final",
"Charset",
"aCharset",
")",
"{",
"return",
"new",
"String",
"(",
"m_aBuffer",
".",
"array",
"(",
")",
",",
"m_aBuffer",
".",
"arrayOffset",
"(",
")",
",",
"m_aBuffer",
".",
... | Get the content as a string without modifying the buffer. This works only
if the contained ByteBuffer has a backing array.
@param aCharset
The charset to use. May not be <code>null</code>.
@return The String representation. | [
"Get",
"the",
"content",
"as",
"a",
"string",
"without",
"modifying",
"the",
"buffer",
".",
"This",
"works",
"only",
"if",
"the",
"contained",
"ByteBuffer",
"has",
"a",
"backing",
"array",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java#L358-L362 |
136,721 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java | ByteBufferOutputStream.write | public void write (@Nonnull final ByteBuffer aSrcBuffer)
{
ValueEnforcer.notNull (aSrcBuffer, "SourceBuffer");
if (m_bCanGrow && aSrcBuffer.remaining () > m_aBuffer.remaining ())
_growBy (aSrcBuffer.remaining ());
m_aBuffer.put (aSrcBuffer);
} | java | public void write (@Nonnull final ByteBuffer aSrcBuffer)
{
ValueEnforcer.notNull (aSrcBuffer, "SourceBuffer");
if (m_bCanGrow && aSrcBuffer.remaining () > m_aBuffer.remaining ())
_growBy (aSrcBuffer.remaining ());
m_aBuffer.put (aSrcBuffer);
} | [
"public",
"void",
"write",
"(",
"@",
"Nonnull",
"final",
"ByteBuffer",
"aSrcBuffer",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aSrcBuffer",
",",
"\"SourceBuffer\"",
")",
";",
"if",
"(",
"m_bCanGrow",
"&&",
"aSrcBuffer",
".",
"remaining",
"(",
")",
">"... | Write the content from the passed byte buffer to this output stream.
@param aSrcBuffer
The buffer to use. May not be <code>null</code>. | [
"Write",
"the",
"content",
"from",
"the",
"passed",
"byte",
"buffer",
"to",
"this",
"output",
"stream",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java#L398-L406 |
136,722 | phax/ph-commons | ph-less-commons/src/main/java/com/helger/lesscommons/homoglyphs/HomoglyphBuilder.java | HomoglyphBuilder.build | @Nonnull
public static Homoglyph build (@Nonnull final IReadableResource aRes) throws IOException
{
ValueEnforcer.notNull (aRes, "Resource");
return build (aRes.getReader (StandardCharsets.ISO_8859_1));
} | java | @Nonnull
public static Homoglyph build (@Nonnull final IReadableResource aRes) throws IOException
{
ValueEnforcer.notNull (aRes, "Resource");
return build (aRes.getReader (StandardCharsets.ISO_8859_1));
} | [
"@",
"Nonnull",
"public",
"static",
"Homoglyph",
"build",
"(",
"@",
"Nonnull",
"final",
"IReadableResource",
"aRes",
")",
"throws",
"IOException",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aRes",
",",
"\"Resource\"",
")",
";",
"return",
"build",
"(",
"aRes",... | Parses the specified resource and uses it to construct a populated
Homoglyph object.
@param aRes
the path to a file containing a list of homoglyphs (see the bundled
char_codes.txt file for an example of the required format)
@return a Homoglyph object populated using the contents of the specified
file
@throws IOException
if the specified file cannot be read | [
"Parses",
"the",
"specified",
"resource",
"and",
"uses",
"it",
"to",
"construct",
"a",
"populated",
"Homoglyph",
"object",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-less-commons/src/main/java/com/helger/lesscommons/homoglyphs/HomoglyphBuilder.java#L81-L86 |
136,723 | phax/ph-commons | ph-less-commons/src/main/java/com/helger/lesscommons/homoglyphs/HomoglyphBuilder.java | HomoglyphBuilder.build | @Nonnull
public static Homoglyph build (@Nonnull @WillClose final Reader aReader) throws IOException
{
ValueEnforcer.notNull (aReader, "reader");
try (final NonBlockingBufferedReader aBR = new NonBlockingBufferedReader (aReader))
{
final ICommonsList <IntSet> aList = new CommonsArrayList <> ();
String sLine;
while ((sLine = aBR.readLine ()) != null)
{
sLine = sLine.trim ();
if (sLine.startsWith ("#") || sLine.length () == 0)
continue;
final IntSet aSet = new IntSet (sLine.length () / 3);
for (final String sCharCode : StringHelper.getExploded (',', sLine))
{
final int nVal = StringParser.parseInt (sCharCode, 16, -1);
if (nVal >= 0)
aSet.add (nVal);
}
aList.add (aSet);
}
return new Homoglyph (aList);
}
} | java | @Nonnull
public static Homoglyph build (@Nonnull @WillClose final Reader aReader) throws IOException
{
ValueEnforcer.notNull (aReader, "reader");
try (final NonBlockingBufferedReader aBR = new NonBlockingBufferedReader (aReader))
{
final ICommonsList <IntSet> aList = new CommonsArrayList <> ();
String sLine;
while ((sLine = aBR.readLine ()) != null)
{
sLine = sLine.trim ();
if (sLine.startsWith ("#") || sLine.length () == 0)
continue;
final IntSet aSet = new IntSet (sLine.length () / 3);
for (final String sCharCode : StringHelper.getExploded (',', sLine))
{
final int nVal = StringParser.parseInt (sCharCode, 16, -1);
if (nVal >= 0)
aSet.add (nVal);
}
aList.add (aSet);
}
return new Homoglyph (aList);
}
} | [
"@",
"Nonnull",
"public",
"static",
"Homoglyph",
"build",
"(",
"@",
"Nonnull",
"@",
"WillClose",
"final",
"Reader",
"aReader",
")",
"throws",
"IOException",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aReader",
",",
"\"reader\"",
")",
";",
"try",
"(",
"final... | Consumes the supplied Reader and uses it to construct a populated Homoglyph
object.
@param aReader
a Reader object that provides access to homoglyph data (see the
bundled char_codes.txt file for an example of the required format)
@return a Homoglyph object populated using the data returned by the Reader
object
@throws IOException
if the specified Reader cannot be read | [
"Consumes",
"the",
"supplied",
"Reader",
"and",
"uses",
"it",
"to",
"construct",
"a",
"populated",
"Homoglyph",
"object",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-less-commons/src/main/java/com/helger/lesscommons/homoglyphs/HomoglyphBuilder.java#L100-L126 |
136,724 | phax/ph-commons | ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java | JAXBMarshallerHelper.setFormattedOutput | public static void setFormattedOutput (@Nonnull final Marshaller aMarshaller, final boolean bFormattedOutput)
{
_setProperty (aMarshaller, Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.valueOf (bFormattedOutput));
} | java | public static void setFormattedOutput (@Nonnull final Marshaller aMarshaller, final boolean bFormattedOutput)
{
_setProperty (aMarshaller, Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.valueOf (bFormattedOutput));
} | [
"public",
"static",
"void",
"setFormattedOutput",
"(",
"@",
"Nonnull",
"final",
"Marshaller",
"aMarshaller",
",",
"final",
"boolean",
"bFormattedOutput",
")",
"{",
"_setProperty",
"(",
"aMarshaller",
",",
"Marshaller",
".",
"JAXB_FORMATTED_OUTPUT",
",",
"Boolean",
"... | Set the standard property for formatting the output or not.
@param aMarshaller
The marshaller to set the property. May not be <code>null</code>.
@param bFormattedOutput
the value to be set | [
"Set",
"the",
"standard",
"property",
"for",
"formatting",
"the",
"output",
"or",
"not",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java#L130-L133 |
136,725 | phax/ph-commons | ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java | JAXBMarshallerHelper.setSchemaLocation | public static void setSchemaLocation (@Nonnull final Marshaller aMarshaller, @Nullable final String sSchemaLocation)
{
_setProperty (aMarshaller, Marshaller.JAXB_SCHEMA_LOCATION, sSchemaLocation);
} | java | public static void setSchemaLocation (@Nonnull final Marshaller aMarshaller, @Nullable final String sSchemaLocation)
{
_setProperty (aMarshaller, Marshaller.JAXB_SCHEMA_LOCATION, sSchemaLocation);
} | [
"public",
"static",
"void",
"setSchemaLocation",
"(",
"@",
"Nonnull",
"final",
"Marshaller",
"aMarshaller",
",",
"@",
"Nullable",
"final",
"String",
"sSchemaLocation",
")",
"{",
"_setProperty",
"(",
"aMarshaller",
",",
"Marshaller",
".",
"JAXB_SCHEMA_LOCATION",
",",... | Set the standard property for setting the namespace schema location
@param aMarshaller
The marshaller to set the property. May not be <code>null</code>.
@param sSchemaLocation
the value to be set | [
"Set",
"the",
"standard",
"property",
"for",
"setting",
"the",
"namespace",
"schema",
"location"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java#L148-L151 |
136,726 | phax/ph-commons | ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java | JAXBMarshallerHelper.setNoNamespaceSchemaLocation | public static void setNoNamespaceSchemaLocation (@Nonnull final Marshaller aMarshaller,
@Nullable final String sSchemaLocation)
{
_setProperty (aMarshaller, Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION, sSchemaLocation);
} | java | public static void setNoNamespaceSchemaLocation (@Nonnull final Marshaller aMarshaller,
@Nullable final String sSchemaLocation)
{
_setProperty (aMarshaller, Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION, sSchemaLocation);
} | [
"public",
"static",
"void",
"setNoNamespaceSchemaLocation",
"(",
"@",
"Nonnull",
"final",
"Marshaller",
"aMarshaller",
",",
"@",
"Nullable",
"final",
"String",
"sSchemaLocation",
")",
"{",
"_setProperty",
"(",
"aMarshaller",
",",
"Marshaller",
".",
"JAXB_NO_NAMESPACE_... | Set the standard property for setting the no-namespace schema location
@param aMarshaller
The marshaller to set the property. May not be <code>null</code>.
@param sSchemaLocation
the value to be set | [
"Set",
"the",
"standard",
"property",
"for",
"setting",
"the",
"no",
"-",
"namespace",
"schema",
"location"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java#L167-L171 |
136,727 | phax/ph-commons | ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java | JAXBMarshallerHelper.setFragment | public static void setFragment (@Nonnull final Marshaller aMarshaller, final boolean bFragment)
{
_setProperty (aMarshaller, Marshaller.JAXB_FRAGMENT, Boolean.valueOf (bFragment));
} | java | public static void setFragment (@Nonnull final Marshaller aMarshaller, final boolean bFragment)
{
_setProperty (aMarshaller, Marshaller.JAXB_FRAGMENT, Boolean.valueOf (bFragment));
} | [
"public",
"static",
"void",
"setFragment",
"(",
"@",
"Nonnull",
"final",
"Marshaller",
"aMarshaller",
",",
"final",
"boolean",
"bFragment",
")",
"{",
"_setProperty",
"(",
"aMarshaller",
",",
"Marshaller",
".",
"JAXB_FRAGMENT",
",",
"Boolean",
".",
"valueOf",
"("... | Set the standard property for marshalling a fragment only.
@param aMarshaller
The marshaller to set the property. May not be <code>null</code>.
@param bFragment
the value to be set | [
"Set",
"the",
"standard",
"property",
"for",
"marshalling",
"a",
"fragment",
"only",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java#L187-L190 |
136,728 | phax/ph-commons | ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java | JAXBMarshallerHelper.setSunIndentString | public static void setSunIndentString (@Nonnull final Marshaller aMarshaller, @Nullable final String sIndentString)
{
final String sPropertyName = SUN_INDENT_STRING;
_setProperty (aMarshaller, sPropertyName, sIndentString);
} | java | public static void setSunIndentString (@Nonnull final Marshaller aMarshaller, @Nullable final String sIndentString)
{
final String sPropertyName = SUN_INDENT_STRING;
_setProperty (aMarshaller, sPropertyName, sIndentString);
} | [
"public",
"static",
"void",
"setSunIndentString",
"(",
"@",
"Nonnull",
"final",
"Marshaller",
"aMarshaller",
",",
"@",
"Nullable",
"final",
"String",
"sIndentString",
")",
"{",
"final",
"String",
"sPropertyName",
"=",
"SUN_INDENT_STRING",
";",
"_setProperty",
"(",
... | Set the Sun specific property for the indent string.
@param aMarshaller
The marshaller to set the property. May not be <code>null</code>.
@param sIndentString
the value to be set | [
"Set",
"the",
"Sun",
"specific",
"property",
"for",
"the",
"indent",
"string",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java#L205-L209 |
136,729 | phax/ph-commons | ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java | JAXBMarshallerHelper.setSunCharacterEscapeHandler | public static void setSunCharacterEscapeHandler (@Nonnull final Marshaller aMarshaller,
@Nonnull final Object aCharacterEscapeHandler)
{
final String sPropertyName = SUN_ENCODING_HANDLER2;
_setProperty (aMarshaller, sPropertyName, aCharacterEscapeHandler);
} | java | public static void setSunCharacterEscapeHandler (@Nonnull final Marshaller aMarshaller,
@Nonnull final Object aCharacterEscapeHandler)
{
final String sPropertyName = SUN_ENCODING_HANDLER2;
_setProperty (aMarshaller, sPropertyName, aCharacterEscapeHandler);
} | [
"public",
"static",
"void",
"setSunCharacterEscapeHandler",
"(",
"@",
"Nonnull",
"final",
"Marshaller",
"aMarshaller",
",",
"@",
"Nonnull",
"final",
"Object",
"aCharacterEscapeHandler",
")",
"{",
"final",
"String",
"sPropertyName",
"=",
"SUN_ENCODING_HANDLER2",
";",
"... | Set the Sun specific encoding handler. Value must implement
com.sun.xml.bind.marshaller.CharacterEscapeHandler
@param aMarshaller
The marshaller to set the property. May not be <code>null</code>.
@param aCharacterEscapeHandler
the value to be set | [
"Set",
"the",
"Sun",
"specific",
"encoding",
"handler",
".",
"Value",
"must",
"implement",
"com",
".",
"sun",
".",
"xml",
".",
"bind",
".",
"marshaller",
".",
"CharacterEscapeHandler"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java#L227-L232 |
136,730 | phax/ph-commons | ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java | JAXBMarshallerHelper.setSunXMLHeaders | public static void setSunXMLHeaders (@Nonnull final Marshaller aMarshaller, @Nonnull final String sXMLHeaders)
{
final String sPropertyName = SUN_XML_HEADERS;
_setProperty (aMarshaller, sPropertyName, sXMLHeaders);
} | java | public static void setSunXMLHeaders (@Nonnull final Marshaller aMarshaller, @Nonnull final String sXMLHeaders)
{
final String sPropertyName = SUN_XML_HEADERS;
_setProperty (aMarshaller, sPropertyName, sXMLHeaders);
} | [
"public",
"static",
"void",
"setSunXMLHeaders",
"(",
"@",
"Nonnull",
"final",
"Marshaller",
"aMarshaller",
",",
"@",
"Nonnull",
"final",
"String",
"sXMLHeaders",
")",
"{",
"final",
"String",
"sPropertyName",
"=",
"SUN_XML_HEADERS",
";",
"_setProperty",
"(",
"aMars... | Set the Sun specific XML header string.
@param aMarshaller
The marshaller to set the property. May not be <code>null</code>.
@param sXMLHeaders
the value to be set | [
"Set",
"the",
"Sun",
"specific",
"XML",
"header",
"string",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java#L293-L297 |
136,731 | phax/ph-commons | ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java | JAXBMarshallerHelper.isSunJAXB2Marshaller | public static boolean isSunJAXB2Marshaller (@Nullable final Marshaller aMarshaller)
{
if (aMarshaller == null)
return false;
final String sClassName = aMarshaller.getClass ().getName ();
return sClassName.equals (JAXB_EXTERNAL_CLASS_NAME);
} | java | public static boolean isSunJAXB2Marshaller (@Nullable final Marshaller aMarshaller)
{
if (aMarshaller == null)
return false;
final String sClassName = aMarshaller.getClass ().getName ();
return sClassName.equals (JAXB_EXTERNAL_CLASS_NAME);
} | [
"public",
"static",
"boolean",
"isSunJAXB2Marshaller",
"(",
"@",
"Nullable",
"final",
"Marshaller",
"aMarshaller",
")",
"{",
"if",
"(",
"aMarshaller",
"==",
"null",
")",
"return",
"false",
";",
"final",
"String",
"sClassName",
"=",
"aMarshaller",
".",
"getClass"... | Check if the passed Marshaller is a Sun JAXB v2 marshaller. Use this method
to determined, whether the Sun specific methods may be invoked or not.
@param aMarshaller
The marshaller to be checked. May be <code>null</code>.
@return <code>true</code> if the passed marshaller is not <code>null</code>
and is of the Sun class. | [
"Check",
"if",
"the",
"passed",
"Marshaller",
"is",
"a",
"Sun",
"JAXB",
"v2",
"marshaller",
".",
"Use",
"this",
"method",
"to",
"determined",
"whether",
"the",
"Sun",
"specific",
"methods",
"may",
"be",
"invoked",
"or",
"not",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java#L356-L362 |
136,732 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java | PDTFormatter.getWithLocale | @Nonnull
public static DateTimeFormatter getWithLocale (@Nonnull final DateTimeFormatter aFormatter,
@Nullable final Locale aDisplayLocale)
{
DateTimeFormatter ret = aFormatter;
if (aDisplayLocale != null)
ret = ret.withLocale (aDisplayLocale);
return ret;
} | java | @Nonnull
public static DateTimeFormatter getWithLocale (@Nonnull final DateTimeFormatter aFormatter,
@Nullable final Locale aDisplayLocale)
{
DateTimeFormatter ret = aFormatter;
if (aDisplayLocale != null)
ret = ret.withLocale (aDisplayLocale);
return ret;
} | [
"@",
"Nonnull",
"public",
"static",
"DateTimeFormatter",
"getWithLocale",
"(",
"@",
"Nonnull",
"final",
"DateTimeFormatter",
"aFormatter",
",",
"@",
"Nullable",
"final",
"Locale",
"aDisplayLocale",
")",
"{",
"DateTimeFormatter",
"ret",
"=",
"aFormatter",
";",
"if",
... | Assign the passed display locale to the passed date time formatter.
@param aFormatter
The formatter to be modified. May not be <code>null</code>.
@param aDisplayLocale
The display locale to be used. May be <code>null</code>.
@return The modified date time formatter. Never <code>null</code>. | [
"Assign",
"the",
"passed",
"display",
"locale",
"to",
"the",
"passed",
"date",
"time",
"formatter",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java#L227-L235 |
136,733 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java | PDTFormatter.getFormatterDate | @Nonnull
public static DateTimeFormatter getFormatterDate (@Nonnull final FormatStyle eStyle,
@Nullable final Locale aDisplayLocale,
@Nonnull final EDTFormatterMode eMode)
{
return _getFormatter (new CacheKey (EDTType.LOCAL_DATE, aDisplayLocale, eStyle, eMode), aDisplayLocale);
} | java | @Nonnull
public static DateTimeFormatter getFormatterDate (@Nonnull final FormatStyle eStyle,
@Nullable final Locale aDisplayLocale,
@Nonnull final EDTFormatterMode eMode)
{
return _getFormatter (new CacheKey (EDTType.LOCAL_DATE, aDisplayLocale, eStyle, eMode), aDisplayLocale);
} | [
"@",
"Nonnull",
"public",
"static",
"DateTimeFormatter",
"getFormatterDate",
"(",
"@",
"Nonnull",
"final",
"FormatStyle",
"eStyle",
",",
"@",
"Nullable",
"final",
"Locale",
"aDisplayLocale",
",",
"@",
"Nonnull",
"final",
"EDTFormatterMode",
"eMode",
")",
"{",
"ret... | Get the date formatter for the passed locale.
@param eStyle
The format style to be used. May not be <code>null</code>.
@param aDisplayLocale
The display locale to be used. May be <code>null</code>.
@param eMode
Print or parse? May not be <code>null</code>.
@return The created date formatter. Never <code>null</code>.
@since 8.5.6 | [
"Get",
"the",
"date",
"formatter",
"for",
"the",
"passed",
"locale",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java#L257-L263 |
136,734 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java | PDTFormatter.getFormatterTime | @Nonnull
public static DateTimeFormatter getFormatterTime (@Nonnull final FormatStyle eStyle,
@Nullable final Locale aDisplayLocale,
@Nonnull final EDTFormatterMode eMode)
{
return _getFormatter (new CacheKey (EDTType.LOCAL_TIME, aDisplayLocale, eStyle, eMode), aDisplayLocale);
} | java | @Nonnull
public static DateTimeFormatter getFormatterTime (@Nonnull final FormatStyle eStyle,
@Nullable final Locale aDisplayLocale,
@Nonnull final EDTFormatterMode eMode)
{
return _getFormatter (new CacheKey (EDTType.LOCAL_TIME, aDisplayLocale, eStyle, eMode), aDisplayLocale);
} | [
"@",
"Nonnull",
"public",
"static",
"DateTimeFormatter",
"getFormatterTime",
"(",
"@",
"Nonnull",
"final",
"FormatStyle",
"eStyle",
",",
"@",
"Nullable",
"final",
"Locale",
"aDisplayLocale",
",",
"@",
"Nonnull",
"final",
"EDTFormatterMode",
"eMode",
")",
"{",
"ret... | Get the time formatter for the passed locale.
@param eStyle
The format style to be used. May not be <code>null</code>.
@param aDisplayLocale
The display locale to be used. May be <code>null</code>.
@param eMode
Print or parse? May not be <code>null</code>.
@return The created time formatter. Never <code>null</code>.
@since 8.5.6 | [
"Get",
"the",
"time",
"formatter",
"for",
"the",
"passed",
"locale",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java#L277-L283 |
136,735 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java | PDTFormatter.getFormatterDateTime | @Nonnull
public static DateTimeFormatter getFormatterDateTime (@Nonnull final FormatStyle eStyle,
@Nullable final Locale aDisplayLocale,
@Nonnull final EDTFormatterMode eMode)
{
return _getFormatter (new CacheKey (EDTType.LOCAL_DATE_TIME, aDisplayLocale, eStyle, eMode), aDisplayLocale);
} | java | @Nonnull
public static DateTimeFormatter getFormatterDateTime (@Nonnull final FormatStyle eStyle,
@Nullable final Locale aDisplayLocale,
@Nonnull final EDTFormatterMode eMode)
{
return _getFormatter (new CacheKey (EDTType.LOCAL_DATE_TIME, aDisplayLocale, eStyle, eMode), aDisplayLocale);
} | [
"@",
"Nonnull",
"public",
"static",
"DateTimeFormatter",
"getFormatterDateTime",
"(",
"@",
"Nonnull",
"final",
"FormatStyle",
"eStyle",
",",
"@",
"Nullable",
"final",
"Locale",
"aDisplayLocale",
",",
"@",
"Nonnull",
"final",
"EDTFormatterMode",
"eMode",
")",
"{",
... | Get the date time formatter for the passed locale.
@param eStyle
The format style to be used. May not be <code>null</code>.
@param aDisplayLocale
The display locale to be used. May be <code>null</code>.
@param eMode
Print or parse? May not be <code>null</code>.
@return The created date time formatter. Never <code>null</code>.
@since 8.5.6 | [
"Get",
"the",
"date",
"time",
"formatter",
"for",
"the",
"passed",
"locale",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java#L297-L303 |
136,736 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/codec/QuotedPrintableCodec.java | QuotedPrintableCodec.writeEncodeQuotedPrintableByte | public static final void writeEncodeQuotedPrintableByte (final int b,
@Nonnull final OutputStream aOS) throws IOException
{
final char cHigh = StringHelper.getHexCharUpperCase ((b >> 4) & 0xF);
final char cLow = StringHelper.getHexCharUpperCase (b & 0xF);
aOS.write (ESCAPE_CHAR);
aOS.write (cHigh);
aOS.write (cLow);
} | java | public static final void writeEncodeQuotedPrintableByte (final int b,
@Nonnull final OutputStream aOS) throws IOException
{
final char cHigh = StringHelper.getHexCharUpperCase ((b >> 4) & 0xF);
final char cLow = StringHelper.getHexCharUpperCase (b & 0xF);
aOS.write (ESCAPE_CHAR);
aOS.write (cHigh);
aOS.write (cLow);
} | [
"public",
"static",
"final",
"void",
"writeEncodeQuotedPrintableByte",
"(",
"final",
"int",
"b",
",",
"@",
"Nonnull",
"final",
"OutputStream",
"aOS",
")",
"throws",
"IOException",
"{",
"final",
"char",
"cHigh",
"=",
"StringHelper",
".",
"getHexCharUpperCase",
"(",... | Encodes byte into its quoted-printable representation.
@param b
byte to encode
@param aOS
the output stream to write to
@throws IOException
In case writing to the OutputStream failed | [
"Encodes",
"byte",
"into",
"its",
"quoted",
"-",
"printable",
"representation",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/codec/QuotedPrintableCodec.java#L103-L111 |
136,737 | phax/ph-commons | ph-collection/src/main/java/com/helger/collection/map/IntFloatMap.java | IntFloatMap._getReadIndex | @CheckForSigned
private int _getReadIndex (final int key)
{
int idx = MapHelper.phiMix (key) & m_nMask;
if (m_aKeys[idx] == key)
{
// we check FREE prior to this call
return idx;
}
if (m_aKeys[idx] == FREE_KEY)
{
// end of chain already
return -1;
}
final int startIdx = idx;
while ((idx = _getNextIndex (idx)) != startIdx)
{
if (m_aKeys[idx] == FREE_KEY)
return -1;
if (m_aKeys[idx] == key)
return idx;
}
return -1;
} | java | @CheckForSigned
private int _getReadIndex (final int key)
{
int idx = MapHelper.phiMix (key) & m_nMask;
if (m_aKeys[idx] == key)
{
// we check FREE prior to this call
return idx;
}
if (m_aKeys[idx] == FREE_KEY)
{
// end of chain already
return -1;
}
final int startIdx = idx;
while ((idx = _getNextIndex (idx)) != startIdx)
{
if (m_aKeys[idx] == FREE_KEY)
return -1;
if (m_aKeys[idx] == key)
return idx;
}
return -1;
} | [
"@",
"CheckForSigned",
"private",
"int",
"_getReadIndex",
"(",
"final",
"int",
"key",
")",
"{",
"int",
"idx",
"=",
"MapHelper",
".",
"phiMix",
"(",
"key",
")",
"&",
"m_nMask",
";",
"if",
"(",
"m_aKeys",
"[",
"idx",
"]",
"==",
"key",
")",
"{",
"// we ... | Find key position in the map.
@param key
Key to look for
@return Key position or -1 if not found | [
"Find",
"key",
"position",
"in",
"the",
"map",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-collection/src/main/java/com/helger/collection/map/IntFloatMap.java#L276-L299 |
136,738 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/locale/LocaleHelper.java | LocaleHelper.getLocaleDisplayName | @Nonnull
public static String getLocaleDisplayName (@Nullable final Locale aLocale, @Nonnull final Locale aContentLocale)
{
ValueEnforcer.notNull (aContentLocale, "ContentLocale");
if (aLocale == null || aLocale.equals (LOCALE_INDEPENDENT))
return ELocaleName.ID_LANGUAGE_INDEPENDENT.getDisplayText (aContentLocale);
if (aLocale.equals (LOCALE_ALL))
return ELocaleName.ID_LANGUAGE_ALL.getDisplayText (aContentLocale);
return aLocale.getDisplayName (aContentLocale);
} | java | @Nonnull
public static String getLocaleDisplayName (@Nullable final Locale aLocale, @Nonnull final Locale aContentLocale)
{
ValueEnforcer.notNull (aContentLocale, "ContentLocale");
if (aLocale == null || aLocale.equals (LOCALE_INDEPENDENT))
return ELocaleName.ID_LANGUAGE_INDEPENDENT.getDisplayText (aContentLocale);
if (aLocale.equals (LOCALE_ALL))
return ELocaleName.ID_LANGUAGE_ALL.getDisplayText (aContentLocale);
return aLocale.getDisplayName (aContentLocale);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getLocaleDisplayName",
"(",
"@",
"Nullable",
"final",
"Locale",
"aLocale",
",",
"@",
"Nonnull",
"final",
"Locale",
"aContentLocale",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aContentLocale",
",",
"\"ContentLoc... | Get the display name of the passed language in the currently selected UI
language.
@param aLocale
The locale from which the display name is required. May be
<code>null</code>.
@param aContentLocale
The locale in which the name of the locale is required. If aLocale
is "de" and display locale is "de" the result would be "Deutsch"
whereas if display locale is "en" the result would be "German".
@return the display name of the language or a fixed text if the passed
Locale is <code>null</code>, "all" or "independent"
@see #LOCALE_ALL
@see #LOCALE_INDEPENDENT | [
"Get",
"the",
"display",
"name",
"of",
"the",
"passed",
"language",
"in",
"the",
"currently",
"selected",
"UI",
"language",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/locale/LocaleHelper.java#L146-L156 |
136,739 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/locale/LocaleHelper.java | LocaleHelper.getAllLocaleDisplayNames | @Nonnull
@ReturnsMutableCopy
public static ICommonsMap <Locale, String> getAllLocaleDisplayNames (@Nonnull final Locale aContentLocale)
{
ValueEnforcer.notNull (aContentLocale, "ContentLocale");
return new CommonsHashMap <> (LocaleCache.getInstance ().getAllLocales (),
Function.identity (),
aLocale -> getLocaleDisplayName (aLocale, aContentLocale));
} | java | @Nonnull
@ReturnsMutableCopy
public static ICommonsMap <Locale, String> getAllLocaleDisplayNames (@Nonnull final Locale aContentLocale)
{
ValueEnforcer.notNull (aContentLocale, "ContentLocale");
return new CommonsHashMap <> (LocaleCache.getInstance ().getAllLocales (),
Function.identity (),
aLocale -> getLocaleDisplayName (aLocale, aContentLocale));
} | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"static",
"ICommonsMap",
"<",
"Locale",
",",
"String",
">",
"getAllLocaleDisplayNames",
"(",
"@",
"Nonnull",
"final",
"Locale",
"aContentLocale",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aContentLocale",
... | Get all possible locale names in the passed locale
@param aContentLocale
the locale ID in which the language list is required
@return The mapping from the input locale to the display text. The result
map is not ordered. | [
"Get",
"all",
"possible",
"locale",
"names",
"in",
"the",
"passed",
"locale"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/locale/LocaleHelper.java#L180-L189 |
136,740 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/locale/LocaleHelper.java | LocaleHelper.getLocaleFromString | @Nonnull
public static Locale getLocaleFromString (@Nullable final String sLocaleAsString)
{
if (StringHelper.hasNoText (sLocaleAsString))
{
// not specified => getDefault
return SystemHelper.getSystemLocale ();
}
String sLanguage;
String sCountry;
String sVariant;
int i1 = sLocaleAsString.indexOf (LOCALE_SEPARATOR);
if (i1 < 0)
{
// No separator present -> use as is
sLanguage = sLocaleAsString;
sCountry = "";
sVariant = "";
}
else
{
// Language found
sLanguage = sLocaleAsString.substring (0, i1);
++i1;
// Find next separator
final int i2 = sLocaleAsString.indexOf (LOCALE_SEPARATOR, i1);
if (i2 < 0)
{
// No other separator -> country is the rest
sCountry = sLocaleAsString.substring (i1);
sVariant = "";
}
else
{
// We have country and variant
sCountry = sLocaleAsString.substring (i1, i2);
sVariant = sLocaleAsString.substring (i2 + 1);
}
}
// Unify elements
if (sLanguage.length () == 2)
sLanguage = sLanguage.toLowerCase (Locale.US);
else
sLanguage = "";
if (sCountry.length () == 2)
sCountry = sCountry.toUpperCase (Locale.US);
else
sCountry = "";
if (sVariant.length () > 0 && (sLanguage.length () == 2 || sCountry.length () == 2))
sVariant = sVariant.toUpperCase (Locale.US);
else
sVariant = "";
// And now resolve using the locale cache
return LocaleCache.getInstance ().getLocale (sLanguage, sCountry, sVariant);
} | java | @Nonnull
public static Locale getLocaleFromString (@Nullable final String sLocaleAsString)
{
if (StringHelper.hasNoText (sLocaleAsString))
{
// not specified => getDefault
return SystemHelper.getSystemLocale ();
}
String sLanguage;
String sCountry;
String sVariant;
int i1 = sLocaleAsString.indexOf (LOCALE_SEPARATOR);
if (i1 < 0)
{
// No separator present -> use as is
sLanguage = sLocaleAsString;
sCountry = "";
sVariant = "";
}
else
{
// Language found
sLanguage = sLocaleAsString.substring (0, i1);
++i1;
// Find next separator
final int i2 = sLocaleAsString.indexOf (LOCALE_SEPARATOR, i1);
if (i2 < 0)
{
// No other separator -> country is the rest
sCountry = sLocaleAsString.substring (i1);
sVariant = "";
}
else
{
// We have country and variant
sCountry = sLocaleAsString.substring (i1, i2);
sVariant = sLocaleAsString.substring (i2 + 1);
}
}
// Unify elements
if (sLanguage.length () == 2)
sLanguage = sLanguage.toLowerCase (Locale.US);
else
sLanguage = "";
if (sCountry.length () == 2)
sCountry = sCountry.toUpperCase (Locale.US);
else
sCountry = "";
if (sVariant.length () > 0 && (sLanguage.length () == 2 || sCountry.length () == 2))
sVariant = sVariant.toUpperCase (Locale.US);
else
sVariant = "";
// And now resolve using the locale cache
return LocaleCache.getInstance ().getLocale (sLanguage, sCountry, sVariant);
} | [
"@",
"Nonnull",
"public",
"static",
"Locale",
"getLocaleFromString",
"(",
"@",
"Nullable",
"final",
"String",
"sLocaleAsString",
")",
"{",
"if",
"(",
"StringHelper",
".",
"hasNoText",
"(",
"sLocaleAsString",
")",
")",
"{",
"// not specified => getDefault",
"return",... | Convert a String in the form "language-country-variant" to a Locale object.
Language needs to have exactly 2 characters. Country is optional but if
present needs to have exactly 2 characters. Variant is optional.
@param sLocaleAsString
The string representation to be converted to a Locale.
@return Never <code>null</code>. If the passed parameter is
<code>null</code> or empty, {@link SystemHelper#getSystemLocale()}
is returned. | [
"Convert",
"a",
"String",
"in",
"the",
"form",
"language",
"-",
"country",
"-",
"variant",
"to",
"a",
"Locale",
"object",
".",
"Language",
"needs",
"to",
"have",
"exactly",
"2",
"characters",
".",
"Country",
"is",
"optional",
"but",
"if",
"present",
"needs... | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/locale/LocaleHelper.java#L234-L295 |
136,741 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper._getWithLeadingOrTrailing | @Nonnull
private static String _getWithLeadingOrTrailing (@Nullable final String sSrc,
@Nonnegative final int nMinLen,
final char cGap,
final boolean bLeading)
{
if (nMinLen <= 0)
{
// Requested length is too short - return as is
return getNotNull (sSrc, "");
}
final int nSrcLen = getLength (sSrc);
if (nSrcLen == 0)
{
// Input string is empty
return getRepeated (cGap, nMinLen);
}
final int nCharsToAdd = nMinLen - nSrcLen;
if (nCharsToAdd <= 0)
{
// Input string is already longer than requested minimum length
return sSrc;
}
final StringBuilder aSB = new StringBuilder (nMinLen);
if (!bLeading)
aSB.append (sSrc);
for (int i = 0; i < nCharsToAdd; ++i)
aSB.append (cGap);
if (bLeading)
aSB.append (sSrc);
return aSB.toString ();
} | java | @Nonnull
private static String _getWithLeadingOrTrailing (@Nullable final String sSrc,
@Nonnegative final int nMinLen,
final char cGap,
final boolean bLeading)
{
if (nMinLen <= 0)
{
// Requested length is too short - return as is
return getNotNull (sSrc, "");
}
final int nSrcLen = getLength (sSrc);
if (nSrcLen == 0)
{
// Input string is empty
return getRepeated (cGap, nMinLen);
}
final int nCharsToAdd = nMinLen - nSrcLen;
if (nCharsToAdd <= 0)
{
// Input string is already longer than requested minimum length
return sSrc;
}
final StringBuilder aSB = new StringBuilder (nMinLen);
if (!bLeading)
aSB.append (sSrc);
for (int i = 0; i < nCharsToAdd; ++i)
aSB.append (cGap);
if (bLeading)
aSB.append (sSrc);
return aSB.toString ();
} | [
"@",
"Nonnull",
"private",
"static",
"String",
"_getWithLeadingOrTrailing",
"(",
"@",
"Nullable",
"final",
"String",
"sSrc",
",",
"@",
"Nonnegative",
"final",
"int",
"nMinLen",
",",
"final",
"char",
"cGap",
",",
"final",
"boolean",
"bLeading",
")",
"{",
"if",
... | Get the result string with at least the desired length, and fill the lead or
trail with the provided char
@param sSrc
Source string. May be <code>null</code> or empty.
@param nMinLen
The destination minimum length. Should be > 0 to have an impact.
@param cGap
The character to use to fill the gap
@param bLeading
<code>true</code> to fill at the front (like "00" in "007") or at the
end (like "00" in "700")
@return Never <code>null</code>. | [
"Get",
"the",
"result",
"string",
"with",
"at",
"least",
"the",
"desired",
"length",
"and",
"fill",
"the",
"lead",
"or",
"trail",
"with",
"the",
"provided",
"char"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L450-L484 |
136,742 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getWithLeading | @Nonnull
public static String getWithLeading (@Nullable final String sSrc, @Nonnegative final int nMinLen, final char cFront)
{
return _getWithLeadingOrTrailing (sSrc, nMinLen, cFront, true);
} | java | @Nonnull
public static String getWithLeading (@Nullable final String sSrc, @Nonnegative final int nMinLen, final char cFront)
{
return _getWithLeadingOrTrailing (sSrc, nMinLen, cFront, true);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getWithLeading",
"(",
"@",
"Nullable",
"final",
"String",
"sSrc",
",",
"@",
"Nonnegative",
"final",
"int",
"nMinLen",
",",
"final",
"char",
"cFront",
")",
"{",
"return",
"_getWithLeadingOrTrailing",
"(",
"sSrc",
"... | Get a string that is filled at the beginning with the passed character until
the minimum length is reached. If the input string is empty, the result is a
string with the provided len only consisting of the passed characters. If the
input String is longer than the provided length, it is returned unchanged.
@param sSrc
Source string. May be <code>null</code>.
@param nMinLen
Minimum length. Should be > 0.
@param cFront
The character to be used at the beginning
@return A non-<code>null</code> string that has at least nLen chars | [
"Get",
"a",
"string",
"that",
"is",
"filled",
"at",
"the",
"beginning",
"with",
"the",
"passed",
"character",
"until",
"the",
"minimum",
"length",
"is",
"reached",
".",
"If",
"the",
"input",
"string",
"is",
"empty",
"the",
"result",
"is",
"a",
"string",
... | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L500-L504 |
136,743 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getWithLeading | @Nonnull
public static String getWithLeading (final int nValue, @Nonnegative final int nMinLen, final char cFront)
{
return _getWithLeadingOrTrailing (Integer.toString (nValue), nMinLen, cFront, true);
} | java | @Nonnull
public static String getWithLeading (final int nValue, @Nonnegative final int nMinLen, final char cFront)
{
return _getWithLeadingOrTrailing (Integer.toString (nValue), nMinLen, cFront, true);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getWithLeading",
"(",
"final",
"int",
"nValue",
",",
"@",
"Nonnegative",
"final",
"int",
"nMinLen",
",",
"final",
"char",
"cFront",
")",
"{",
"return",
"_getWithLeadingOrTrailing",
"(",
"Integer",
".",
"toString",
... | Get a string that is filled at the beginning with the passed character until
the minimum length is reached. If the input String is longer than the
provided length, it is returned unchanged.
@param nValue
Source string. May be <code>null</code>.
@param nMinLen
Minimum length. Should be > 0.
@param cFront
The character to be used at the beginning
@return A non-<code>null</code> string that has at least nLen chars
@see #getWithLeading(String, int, char) | [
"Get",
"a",
"string",
"that",
"is",
"filled",
"at",
"the",
"beginning",
"with",
"the",
"passed",
"character",
"until",
"the",
"minimum",
"length",
"is",
"reached",
".",
"If",
"the",
"input",
"String",
"is",
"longer",
"than",
"the",
"provided",
"length",
"i... | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L520-L524 |
136,744 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getWithTrailing | @Nonnull
public static String getWithTrailing (@Nullable final String sSrc, @Nonnegative final int nMinLen, final char cEnd)
{
return _getWithLeadingOrTrailing (sSrc, nMinLen, cEnd, false);
} | java | @Nonnull
public static String getWithTrailing (@Nullable final String sSrc, @Nonnegative final int nMinLen, final char cEnd)
{
return _getWithLeadingOrTrailing (sSrc, nMinLen, cEnd, false);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getWithTrailing",
"(",
"@",
"Nullable",
"final",
"String",
"sSrc",
",",
"@",
"Nonnegative",
"final",
"int",
"nMinLen",
",",
"final",
"char",
"cEnd",
")",
"{",
"return",
"_getWithLeadingOrTrailing",
"(",
"sSrc",
",... | Get a string that is filled at the end with the passed character until the
minimum length is reached. If the input string is empty, the result is a
string with the provided len only consisting of the passed characters. If the
input String is longer than the provided length, it is returned unchanged.
@param sSrc
Source string. May be <code>null</code>.
@param nMinLen
Minimum length. Should be > 0.
@param cEnd
The character to be used at the end
@return A non-<code>null</code> string that has at least nLen chars | [
"Get",
"a",
"string",
"that",
"is",
"filled",
"at",
"the",
"end",
"with",
"the",
"passed",
"character",
"until",
"the",
"minimum",
"length",
"is",
"reached",
".",
"If",
"the",
"input",
"string",
"is",
"empty",
"the",
"result",
"is",
"a",
"string",
"with"... | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L560-L564 |
136,745 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getHexEncoded | @Nonnull
public static String getHexEncoded (@Nonnull final String sInput, @Nonnull final Charset aCharset)
{
ValueEnforcer.notNull (sInput, "Input");
ValueEnforcer.notNull (aCharset, "Charset");
return getHexEncoded (sInput.getBytes (aCharset));
} | java | @Nonnull
public static String getHexEncoded (@Nonnull final String sInput, @Nonnull final Charset aCharset)
{
ValueEnforcer.notNull (sInput, "Input");
ValueEnforcer.notNull (aCharset, "Charset");
return getHexEncoded (sInput.getBytes (aCharset));
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getHexEncoded",
"(",
"@",
"Nonnull",
"final",
"String",
"sInput",
",",
"@",
"Nonnull",
"final",
"Charset",
"aCharset",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"sInput",
",",
"\"Input\"",
")",
";",
"Value... | Convert a string to a byte array and than to a hexadecimal encoded string.
@param sInput
The source string. May not be <code>null</code>.
@param aCharset
The charset to use. May not be <code>null</code>.
@return The String representation of the byte array of the string. | [
"Convert",
"a",
"string",
"to",
"a",
"byte",
"array",
"and",
"than",
"to",
"a",
"hexadecimal",
"encoded",
"string",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L601-L608 |
136,746 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getLeadingCharCount | @Nonnegative
public static int getLeadingCharCount (@Nullable final String s, final char c)
{
int ret = 0;
if (s != null)
{
final int nMax = s.length ();
while (ret < nMax && s.charAt (ret) == c)
++ret;
}
return ret;
} | java | @Nonnegative
public static int getLeadingCharCount (@Nullable final String s, final char c)
{
int ret = 0;
if (s != null)
{
final int nMax = s.length ();
while (ret < nMax && s.charAt (ret) == c)
++ret;
}
return ret;
} | [
"@",
"Nonnegative",
"public",
"static",
"int",
"getLeadingCharCount",
"(",
"@",
"Nullable",
"final",
"String",
"s",
",",
"final",
"char",
"c",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"final",
"int",
"nMax",
"=",... | Get the number of specified chars, the passed string starts with.
@param s
The string to be parsed. May be <code>null</code>.
@param c
The char to be searched.
@return Always ≥ 0. | [
"Get",
"the",
"number",
"of",
"specified",
"chars",
"the",
"passed",
"string",
"starts",
"with",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L839-L850 |
136,747 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getTrailingCharCount | @Nonnegative
public static int getTrailingCharCount (@Nullable final String s, final char c)
{
int ret = 0;
if (s != null)
{
int nLast = s.length () - 1;
while (nLast >= 0 && s.charAt (nLast) == c)
{
++ret;
--nLast;
}
}
return ret;
} | java | @Nonnegative
public static int getTrailingCharCount (@Nullable final String s, final char c)
{
int ret = 0;
if (s != null)
{
int nLast = s.length () - 1;
while (nLast >= 0 && s.charAt (nLast) == c)
{
++ret;
--nLast;
}
}
return ret;
} | [
"@",
"Nonnegative",
"public",
"static",
"int",
"getTrailingCharCount",
"(",
"@",
"Nullable",
"final",
"String",
"s",
",",
"final",
"char",
"c",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"int",
"nLast",
"=",
"s",
... | Get the number of specified chars, the passed string ends with.
@param s
The string to be parsed. May be <code>null</code>.
@param c
The char to be searched.
@return Always ≥ 0. | [
"Get",
"the",
"number",
"of",
"specified",
"chars",
"the",
"passed",
"string",
"ends",
"with",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L861-L875 |
136,748 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getImplodedMapped | @Nonnull
public static <ELEMENTTYPE> String getImplodedMapped (@Nonnull final String sSep,
@Nullable final ELEMENTTYPE [] aElements,
@Nonnull final Function <? super ELEMENTTYPE, String> aMapper)
{
ValueEnforcer.notNull (sSep, "Separator");
ValueEnforcer.notNull (aMapper, "Mapper");
if (ArrayHelper.isEmpty (aElements))
return "";
return getImplodedMapped (sSep, aElements, 0, aElements.length, aMapper);
} | java | @Nonnull
public static <ELEMENTTYPE> String getImplodedMapped (@Nonnull final String sSep,
@Nullable final ELEMENTTYPE [] aElements,
@Nonnull final Function <? super ELEMENTTYPE, String> aMapper)
{
ValueEnforcer.notNull (sSep, "Separator");
ValueEnforcer.notNull (aMapper, "Mapper");
if (ArrayHelper.isEmpty (aElements))
return "";
return getImplodedMapped (sSep, aElements, 0, aElements.length, aMapper);
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"ELEMENTTYPE",
">",
"String",
"getImplodedMapped",
"(",
"@",
"Nonnull",
"final",
"String",
"sSep",
",",
"@",
"Nullable",
"final",
"ELEMENTTYPE",
"[",
"]",
"aElements",
",",
"@",
"Nonnull",
"final",
"Function",
"<",
"?... | Get a concatenated String from all elements of the passed array, separated by
the specified separator string.
@param sSep
The separator to use. May not be <code>null</code>.
@param aElements
The container to convert. May be <code>null</code> or empty.
@param aMapper
The mapping function to convert from ELEMENTTYPE to String. May not be
<code>null</code>.
@return The concatenated string.
@param <ELEMENTTYPE>
The type of elements to be imploded.
@since 8.5.6 | [
"Get",
"a",
"concatenated",
"String",
"from",
"all",
"elements",
"of",
"the",
"passed",
"array",
"separated",
"by",
"the",
"specified",
"separator",
"string",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L1335-L1346 |
136,749 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.explode | public static void explode (final char cSep,
@Nullable final String sElements,
@Nonnull final Consumer <? super String> aConsumer)
{
explode (cSep, sElements, -1, aConsumer);
} | java | public static void explode (final char cSep,
@Nullable final String sElements,
@Nonnull final Consumer <? super String> aConsumer)
{
explode (cSep, sElements, -1, aConsumer);
} | [
"public",
"static",
"void",
"explode",
"(",
"final",
"char",
"cSep",
",",
"@",
"Nullable",
"final",
"String",
"sElements",
",",
"@",
"Nonnull",
"final",
"Consumer",
"<",
"?",
"super",
"String",
">",
"aConsumer",
")",
"{",
"explode",
"(",
"cSep",
",",
"sE... | Split the provided string by the provided separator and invoke the consumer
for each matched element. The number of returned items is unlimited.
@param cSep
The separator to use.
@param sElements
The concatenated String to convert. May be <code>null</code> or empty.
@param aConsumer
The non-<code>null</code> consumer that is invoked for each exploded
element | [
"Split",
"the",
"provided",
"string",
"by",
"the",
"provided",
"separator",
"and",
"invoke",
"the",
"consumer",
"for",
"each",
"matched",
"element",
".",
"The",
"number",
"of",
"returned",
"items",
"is",
"unlimited",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2013-L2018 |
136,750 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getExploded | @Nonnull
@CodingStyleguideUnaware
public static <COLLTYPE extends Collection <String>> COLLTYPE getExploded (@Nonnull final String sSep,
@Nullable final String sElements,
final int nMaxItems,
@Nonnull final COLLTYPE aCollection)
{
explode (sSep, sElements, nMaxItems, aCollection::add);
return aCollection;
} | java | @Nonnull
@CodingStyleguideUnaware
public static <COLLTYPE extends Collection <String>> COLLTYPE getExploded (@Nonnull final String sSep,
@Nullable final String sElements,
final int nMaxItems,
@Nonnull final COLLTYPE aCollection)
{
explode (sSep, sElements, nMaxItems, aCollection::add);
return aCollection;
} | [
"@",
"Nonnull",
"@",
"CodingStyleguideUnaware",
"public",
"static",
"<",
"COLLTYPE",
"extends",
"Collection",
"<",
"String",
">",
">",
"COLLTYPE",
"getExploded",
"(",
"@",
"Nonnull",
"final",
"String",
"sSep",
",",
"@",
"Nullable",
"final",
"String",
"sElements"... | Take a concatenated String and return the passed Collection of all elements
in the passed string, using specified separator string.
@param <COLLTYPE>
The collection type to be used and returned
@param sSep
The separator to use. May not be <code>null</code>.
@param sElements
The concatenated String to convert. May be <code>null</code> or empty.
@param nMaxItems
The maximum number of items to explode. If the passed value is ≤ 0
all items are used. If max items is 1, than the result string is
returned as is. If max items is larger than the number of elements
found, it has no effect.
@param aCollection
The non-<code>null</code> target collection that should be filled with
the exploded elements
@return The passed collection and never <code>null</code>. | [
"Take",
"a",
"concatenated",
"String",
"and",
"return",
"the",
"passed",
"Collection",
"of",
"all",
"elements",
"in",
"the",
"passed",
"string",
"using",
"specified",
"separator",
"string",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2139-L2148 |
136,751 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.explode | public static void explode (@Nonnull final String sSep,
@Nullable final String sElements,
@Nonnull final Consumer <? super String> aConsumer)
{
explode (sSep, sElements, -1, aConsumer);
} | java | public static void explode (@Nonnull final String sSep,
@Nullable final String sElements,
@Nonnull final Consumer <? super String> aConsumer)
{
explode (sSep, sElements, -1, aConsumer);
} | [
"public",
"static",
"void",
"explode",
"(",
"@",
"Nonnull",
"final",
"String",
"sSep",
",",
"@",
"Nullable",
"final",
"String",
"sElements",
",",
"@",
"Nonnull",
"final",
"Consumer",
"<",
"?",
"super",
"String",
">",
"aConsumer",
")",
"{",
"explode",
"(",
... | Split the provided string by the provided separator and invoke the consumer
for each matched element.
@param sSep
The separator to use. May not be <code>null</code>.
@param sElements
The concatenated String to convert. May be <code>null</code> or empty.
@param aConsumer
The non-<code>null</code> consumer that is invoked for each exploded
element | [
"Split",
"the",
"provided",
"string",
"by",
"the",
"provided",
"separator",
"and",
"invoke",
"the",
"consumer",
"for",
"each",
"matched",
"element",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2162-L2167 |
136,752 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getIndexOf | public static int getIndexOf (@Nullable final String sText,
@Nonnegative final int nFromIndex,
@Nullable final String sSearch)
{
return sText != null &&
sSearch != null &&
(sText.length () - nFromIndex) >= sSearch.length () ? sText.indexOf (sSearch, nFromIndex) : STRING_NOT_FOUND;
} | java | public static int getIndexOf (@Nullable final String sText,
@Nonnegative final int nFromIndex,
@Nullable final String sSearch)
{
return sText != null &&
sSearch != null &&
(sText.length () - nFromIndex) >= sSearch.length () ? sText.indexOf (sSearch, nFromIndex) : STRING_NOT_FOUND;
} | [
"public",
"static",
"int",
"getIndexOf",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"@",
"Nonnegative",
"final",
"int",
"nFromIndex",
",",
"@",
"Nullable",
"final",
"String",
"sSearch",
")",
"{",
"return",
"sText",
"!=",
"null",
"&&",
"sSearch",
... | Get the first index of sSearch within sText starting at index nFromIndex.
@param sText
The text to search in. May be <code>null</code>.
@param nFromIndex
The index to start searching in the source string
@param sSearch
The text to search for. May be <code>null</code>.
@return The first index of sSearch within sText or {@value #STRING_NOT_FOUND}
if sSearch was not found or if any parameter was <code>null</code>.
@see String#indexOf(String,int) | [
"Get",
"the",
"first",
"index",
"of",
"sSearch",
"within",
"sText",
"starting",
"at",
"index",
"nFromIndex",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2695-L2702 |
136,753 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getLastIndexOf | public static int getLastIndexOf (@Nullable final String sText, @Nullable final String sSearch)
{
return sText != null && sSearch != null && sText.length () >= sSearch.length () ? sText.lastIndexOf (sSearch)
: STRING_NOT_FOUND;
} | java | public static int getLastIndexOf (@Nullable final String sText, @Nullable final String sSearch)
{
return sText != null && sSearch != null && sText.length () >= sSearch.length () ? sText.lastIndexOf (sSearch)
: STRING_NOT_FOUND;
} | [
"public",
"static",
"int",
"getLastIndexOf",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"@",
"Nullable",
"final",
"String",
"sSearch",
")",
"{",
"return",
"sText",
"!=",
"null",
"&&",
"sSearch",
"!=",
"null",
"&&",
"sText",
".",
"length",
"(",
... | Get the last index of sSearch within sText.
@param sText
The text to search in. May be <code>null</code>.
@param sSearch
The text to search for. May be <code>null</code>.
@return The last index of sSearch within sText or {@value #STRING_NOT_FOUND}
if sSearch was not found or if any parameter was <code>null</code>.
@see String#lastIndexOf(String) | [
"Get",
"the",
"last",
"index",
"of",
"sSearch",
"within",
"sText",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2715-L2719 |
136,754 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getIndexOf | public static int getIndexOf (@Nullable final String sText, final char cSearch)
{
return sText != null && sText.length () >= 1 ? sText.indexOf (cSearch) : STRING_NOT_FOUND;
} | java | public static int getIndexOf (@Nullable final String sText, final char cSearch)
{
return sText != null && sText.length () >= 1 ? sText.indexOf (cSearch) : STRING_NOT_FOUND;
} | [
"public",
"static",
"int",
"getIndexOf",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"final",
"char",
"cSearch",
")",
"{",
"return",
"sText",
"!=",
"null",
"&&",
"sText",
".",
"length",
"(",
")",
">=",
"1",
"?",
"sText",
".",
"indexOf",
"(",... | Get the first index of cSearch within sText.
@param sText
The text to search in. May be <code>null</code>.
@param cSearch
The character to search for. May be <code>null</code>.
@return The first index of sSearch within sText or {@value #STRING_NOT_FOUND}
if cSearch was not found or if any parameter was <code>null</code>.
@see String#indexOf(int) | [
"Get",
"the",
"first",
"index",
"of",
"cSearch",
"within",
"sText",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2755-L2758 |
136,755 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getLastIndexOf | public static int getLastIndexOf (@Nullable final String sText, final char cSearch)
{
return sText != null && sText.length () >= 1 ? sText.lastIndexOf (cSearch) : STRING_NOT_FOUND;
} | java | public static int getLastIndexOf (@Nullable final String sText, final char cSearch)
{
return sText != null && sText.length () >= 1 ? sText.lastIndexOf (cSearch) : STRING_NOT_FOUND;
} | [
"public",
"static",
"int",
"getLastIndexOf",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"final",
"char",
"cSearch",
")",
"{",
"return",
"sText",
"!=",
"null",
"&&",
"sText",
".",
"length",
"(",
")",
">=",
"1",
"?",
"sText",
".",
"lastIndexOf"... | Get the last index of cSearch within sText.
@param sText
The text to search in. May be <code>null</code>.
@param cSearch
The character to search for. May be <code>null</code>.
@return The last index of sSearch within sText or {@value #STRING_NOT_FOUND}
if cSearch was not found or if any parameter was <code>null</code>.
@see String#lastIndexOf(int) | [
"Get",
"the",
"last",
"index",
"of",
"cSearch",
"within",
"sText",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2790-L2793 |
136,756 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getIndexOfIgnoreCase | public static int getIndexOfIgnoreCase (@Nullable final String sText,
@Nonnegative final int nFromIndex,
@Nullable final String sSearch,
@Nonnull final Locale aSortLocale)
{
return sText != null &&
sSearch != null &&
(sText.length () - nFromIndex) >= sSearch.length ()
? sText.toLowerCase (aSortLocale)
.indexOf (sSearch.toLowerCase (aSortLocale),
nFromIndex)
: STRING_NOT_FOUND;
} | java | public static int getIndexOfIgnoreCase (@Nullable final String sText,
@Nonnegative final int nFromIndex,
@Nullable final String sSearch,
@Nonnull final Locale aSortLocale)
{
return sText != null &&
sSearch != null &&
(sText.length () - nFromIndex) >= sSearch.length ()
? sText.toLowerCase (aSortLocale)
.indexOf (sSearch.toLowerCase (aSortLocale),
nFromIndex)
: STRING_NOT_FOUND;
} | [
"public",
"static",
"int",
"getIndexOfIgnoreCase",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"@",
"Nonnegative",
"final",
"int",
"nFromIndex",
",",
"@",
"Nullable",
"final",
"String",
"sSearch",
",",
"@",
"Nonnull",
"final",
"Locale",
"aSortLocale",... | Get the first index of sSearch within sText ignoring case starting at index
nFromIndex.
@param sText
The text to search in. May be <code>null</code>.
@param nFromIndex
The index to start searching in the source string
@param sSearch
The text to search for. May be <code>null</code>.
@param aSortLocale
The locale to be used for case unifying.
@return The first index of sSearch within sText or {@value #STRING_NOT_FOUND}
if sSearch was not found or if any parameter was <code>null</code>.
@see String#indexOf(String) | [
"Get",
"the",
"first",
"index",
"of",
"sSearch",
"within",
"sText",
"ignoring",
"case",
"starting",
"at",
"index",
"nFromIndex",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2852-L2864 |
136,757 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getLastIndexOfIgnoreCase | public static int getLastIndexOfIgnoreCase (@Nullable final String sText,
@Nullable final String sSearch,
@Nonnull final Locale aSortLocale)
{
return sText != null &&
sSearch != null &&
sText.length () >= sSearch.length () ? sText.toLowerCase (aSortLocale).lastIndexOf (sSearch.toLowerCase (aSortLocale)) : STRING_NOT_FOUND;
} | java | public static int getLastIndexOfIgnoreCase (@Nullable final String sText,
@Nullable final String sSearch,
@Nonnull final Locale aSortLocale)
{
return sText != null &&
sSearch != null &&
sText.length () >= sSearch.length () ? sText.toLowerCase (aSortLocale).lastIndexOf (sSearch.toLowerCase (aSortLocale)) : STRING_NOT_FOUND;
} | [
"public",
"static",
"int",
"getLastIndexOfIgnoreCase",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"@",
"Nullable",
"final",
"String",
"sSearch",
",",
"@",
"Nonnull",
"final",
"Locale",
"aSortLocale",
")",
"{",
"return",
"sText",
"!=",
"null",
"&&",... | Get the last index of sSearch within sText ignoring case.
@param sText
The text to search in. May be <code>null</code>.
@param sSearch
The text to search for. May be <code>null</code>.
@param aSortLocale
The locale to be used for case unifying.
@return The last index of sSearch within sText or {@value #STRING_NOT_FOUND}
if sSearch was not found or if any parameter was <code>null</code>.
@see String#lastIndexOf(String) | [
"Get",
"the",
"last",
"index",
"of",
"sSearch",
"within",
"sText",
"ignoring",
"case",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2879-L2886 |
136,758 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getIndexOfIgnoreCase | public static int getIndexOfIgnoreCase (@Nullable final String sText,
final char cSearch,
@Nonnull final Locale aSortLocale)
{
return sText != null && sText.length () >= 1 ? sText.toLowerCase (aSortLocale)
.indexOf (Character.toLowerCase (cSearch))
: STRING_NOT_FOUND;
} | java | public static int getIndexOfIgnoreCase (@Nullable final String sText,
final char cSearch,
@Nonnull final Locale aSortLocale)
{
return sText != null && sText.length () >= 1 ? sText.toLowerCase (aSortLocale)
.indexOf (Character.toLowerCase (cSearch))
: STRING_NOT_FOUND;
} | [
"public",
"static",
"int",
"getIndexOfIgnoreCase",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"final",
"char",
"cSearch",
",",
"@",
"Nonnull",
"final",
"Locale",
"aSortLocale",
")",
"{",
"return",
"sText",
"!=",
"null",
"&&",
"sText",
".",
"lengt... | Get the first index of cSearch within sText ignoring case.
@param sText
The text to search in. May be <code>null</code>.
@param cSearch
The char to search for. May be <code>null</code>.
@param aSortLocale
The locale to be used for case unifying.
@return The first index of sSearch within sText or {@value #STRING_NOT_FOUND}
if sSearch was not found or if any parameter was <code>null</code>.
@see String#indexOf(int) | [
"Get",
"the",
"first",
"index",
"of",
"cSearch",
"within",
"sText",
"ignoring",
"case",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2931-L2938 |
136,759 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getLastIndexOfIgnoreCase | public static int getLastIndexOfIgnoreCase (@Nullable final String sText,
final char cSearch,
@Nonnull final Locale aSortLocale)
{
return sText != null && sText.length () >= 1
? sText.toLowerCase (aSortLocale)
.lastIndexOf (Character.toLowerCase (cSearch))
: STRING_NOT_FOUND;
} | java | public static int getLastIndexOfIgnoreCase (@Nullable final String sText,
final char cSearch,
@Nonnull final Locale aSortLocale)
{
return sText != null && sText.length () >= 1
? sText.toLowerCase (aSortLocale)
.lastIndexOf (Character.toLowerCase (cSearch))
: STRING_NOT_FOUND;
} | [
"public",
"static",
"int",
"getLastIndexOfIgnoreCase",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"final",
"char",
"cSearch",
",",
"@",
"Nonnull",
"final",
"Locale",
"aSortLocale",
")",
"{",
"return",
"sText",
"!=",
"null",
"&&",
"sText",
".",
"l... | Get the last index of cSearch within sText ignoring case.
@param sText
The text to search in. May be <code>null</code>.
@param cSearch
The char to search for. May be <code>null</code>.
@param aSortLocale
The locale to be used for case unifying.
@return The last index of sSearch within sText or {@value #STRING_NOT_FOUND}
if sSearch was not found or if any parameter was <code>null</code>.
@see String#lastIndexOf(int) | [
"Get",
"the",
"last",
"index",
"of",
"cSearch",
"within",
"sText",
"ignoring",
"case",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2980-L2988 |
136,760 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.contains | public static boolean contains (@Nullable final String sText, @Nullable final String sSearch)
{
return getIndexOf (sText, sSearch) != STRING_NOT_FOUND;
} | java | public static boolean contains (@Nullable final String sText, @Nullable final String sSearch)
{
return getIndexOf (sText, sSearch) != STRING_NOT_FOUND;
} | [
"public",
"static",
"boolean",
"contains",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"@",
"Nullable",
"final",
"String",
"sSearch",
")",
"{",
"return",
"getIndexOf",
"(",
"sText",
",",
"sSearch",
")",
"!=",
"STRING_NOT_FOUND",
";",
"}"
] | Check if sSearch is contained within sText.
@param sText
The text to search in. May be <code>null</code>.
@param sSearch
The text to search for. May be <code>null</code>.
@return <code>true</code> if sSearch is contained in sText,
<code>false</code> otherwise.
@see String#contains(CharSequence) | [
"Check",
"if",
"sSearch",
"is",
"contained",
"within",
"sText",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3028-L3031 |
136,761 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.containsIgnoreCase | public static boolean containsIgnoreCase (@Nullable final String sText,
@Nullable final String sSearch,
@Nonnull final Locale aSortLocale)
{
return getIndexOfIgnoreCase (sText, sSearch, aSortLocale) != STRING_NOT_FOUND;
} | java | public static boolean containsIgnoreCase (@Nullable final String sText,
@Nullable final String sSearch,
@Nonnull final Locale aSortLocale)
{
return getIndexOfIgnoreCase (sText, sSearch, aSortLocale) != STRING_NOT_FOUND;
} | [
"public",
"static",
"boolean",
"containsIgnoreCase",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"@",
"Nullable",
"final",
"String",
"sSearch",
",",
"@",
"Nonnull",
"final",
"Locale",
"aSortLocale",
")",
"{",
"return",
"getIndexOfIgnoreCase",
"(",
"sT... | Check if sSearch is contained within sText ignoring case.
@param sText
The text to search in. May be <code>null</code>.
@param sSearch
The text to search for. May be <code>null</code>.
@param aSortLocale
The locale to be used for case unifying.
@return <code>true</code> if sSearch is contained in sText,
<code>false</code> otherwise.
@see String#contains(CharSequence) | [
"Check",
"if",
"sSearch",
"is",
"contained",
"within",
"sText",
"ignoring",
"case",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3062-L3067 |
136,762 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.containsIgnoreCase | public static boolean containsIgnoreCase (@Nullable final String sText,
final char cSearch,
@Nonnull final Locale aSortLocale)
{
return getIndexOfIgnoreCase (sText, cSearch, aSortLocale) != STRING_NOT_FOUND;
} | java | public static boolean containsIgnoreCase (@Nullable final String sText,
final char cSearch,
@Nonnull final Locale aSortLocale)
{
return getIndexOfIgnoreCase (sText, cSearch, aSortLocale) != STRING_NOT_FOUND;
} | [
"public",
"static",
"boolean",
"containsIgnoreCase",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"final",
"char",
"cSearch",
",",
"@",
"Nonnull",
"final",
"Locale",
"aSortLocale",
")",
"{",
"return",
"getIndexOfIgnoreCase",
"(",
"sText",
",",
"cSearch... | Check if cSearch is contained within sText ignoring case.
@param sText
The text to search in. May be <code>null</code>.
@param cSearch
The char to search for. May be <code>null</code>.
@param aSortLocale
The locale to be used for case unifying.
@return <code>true</code> if sSearch is contained in sText,
<code>false</code> otherwise.
@see String#indexOf(int) | [
"Check",
"if",
"cSearch",
"is",
"contained",
"within",
"sText",
"ignoring",
"case",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3082-L3087 |
136,763 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.containsAny | public static boolean containsAny (@Nullable final char [] aInput, @Nonnull final char [] aSearchChars)
{
ValueEnforcer.notNull (aSearchChars, "SearchChars");
if (aInput != null)
for (final char cIn : aInput)
if (ArrayHelper.contains (aSearchChars, cIn))
return true;
return false;
} | java | public static boolean containsAny (@Nullable final char [] aInput, @Nonnull final char [] aSearchChars)
{
ValueEnforcer.notNull (aSearchChars, "SearchChars");
if (aInput != null)
for (final char cIn : aInput)
if (ArrayHelper.contains (aSearchChars, cIn))
return true;
return false;
} | [
"public",
"static",
"boolean",
"containsAny",
"(",
"@",
"Nullable",
"final",
"char",
"[",
"]",
"aInput",
",",
"@",
"Nonnull",
"final",
"char",
"[",
"]",
"aSearchChars",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aSearchChars",
",",
"\"SearchChars\"",
"... | Check if any of the passed searched characters is contained in the input char
array.
@param aInput
The input char array. May be <code>null</code>.
@param aSearchChars
The char array to search. May not be <code>null</code>.
@return <code>true</code> if at least any of the search char is contained in
the input char array, <code>false</code> otherwise. | [
"Check",
"if",
"any",
"of",
"the",
"passed",
"searched",
"characters",
"is",
"contained",
"in",
"the",
"input",
"char",
"array",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3100-L3109 |
136,764 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.containsAny | public static boolean containsAny (@Nullable final String sInput, @Nonnull final char [] aSearchChars)
{
return sInput != null && containsAny (sInput.toCharArray (), aSearchChars);
} | java | public static boolean containsAny (@Nullable final String sInput, @Nonnull final char [] aSearchChars)
{
return sInput != null && containsAny (sInput.toCharArray (), aSearchChars);
} | [
"public",
"static",
"boolean",
"containsAny",
"(",
"@",
"Nullable",
"final",
"String",
"sInput",
",",
"@",
"Nonnull",
"final",
"char",
"[",
"]",
"aSearchChars",
")",
"{",
"return",
"sInput",
"!=",
"null",
"&&",
"containsAny",
"(",
"sInput",
".",
"toCharArray... | Check if any of the passed searched characters in contained in the input
string.
@param sInput
The input string. May be <code>null</code>.
@param aSearchChars
The char array to search. May not be <code>null</code>.
@return <code>true</code> if at least any of the search char is contained in
the input char array, <code>false</code> otherwise. | [
"Check",
"if",
"any",
"of",
"the",
"passed",
"searched",
"characters",
"in",
"contained",
"in",
"the",
"input",
"string",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3122-L3125 |
136,765 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getOccurrenceCount | @Nonnegative
public static int getOccurrenceCount (@Nullable final String sText, @Nullable final String sSearch)
{
int ret = 0;
final int nTextLength = getLength (sText);
final int nSearchLength = getLength (sSearch);
if (nSearchLength > 0 && nTextLength >= nSearchLength)
{
int nLastIndex = 0;
int nIndex;
do
{
// Start searching from the last result
nIndex = getIndexOf (sText, nLastIndex, sSearch);
if (nIndex != STRING_NOT_FOUND)
{
// Match found
++ret;
// Identify the next starting position (relative index + number of
// search strings)
nLastIndex = nIndex + nSearchLength;
}
} while (nIndex != STRING_NOT_FOUND);
}
return ret;
} | java | @Nonnegative
public static int getOccurrenceCount (@Nullable final String sText, @Nullable final String sSearch)
{
int ret = 0;
final int nTextLength = getLength (sText);
final int nSearchLength = getLength (sSearch);
if (nSearchLength > 0 && nTextLength >= nSearchLength)
{
int nLastIndex = 0;
int nIndex;
do
{
// Start searching from the last result
nIndex = getIndexOf (sText, nLastIndex, sSearch);
if (nIndex != STRING_NOT_FOUND)
{
// Match found
++ret;
// Identify the next starting position (relative index + number of
// search strings)
nLastIndex = nIndex + nSearchLength;
}
} while (nIndex != STRING_NOT_FOUND);
}
return ret;
} | [
"@",
"Nonnegative",
"public",
"static",
"int",
"getOccurrenceCount",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"@",
"Nullable",
"final",
"String",
"sSearch",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"final",
"int",
"nTextLength",
"=",
"getLength",... | Count the number of occurrences of sSearch within sText.
@param sText
The text to search in. May be <code>null</code>.
@param sSearch
The text to search for. May be <code>null</code>.
@return A non-negative number of occurrences. | [
"Count",
"the",
"number",
"of",
"occurrences",
"of",
"sSearch",
"within",
"sText",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3136-L3162 |
136,766 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getOccurrenceCountIgnoreCase | @Nonnegative
public static int getOccurrenceCountIgnoreCase (@Nullable final String sText,
@Nullable final String sSearch,
@Nonnull final Locale aSortLocale)
{
return sText != null && sSearch != null ? getOccurrenceCount (sText.toLowerCase (aSortLocale),
sSearch.toLowerCase (aSortLocale))
: 0;
} | java | @Nonnegative
public static int getOccurrenceCountIgnoreCase (@Nullable final String sText,
@Nullable final String sSearch,
@Nonnull final Locale aSortLocale)
{
return sText != null && sSearch != null ? getOccurrenceCount (sText.toLowerCase (aSortLocale),
sSearch.toLowerCase (aSortLocale))
: 0;
} | [
"@",
"Nonnegative",
"public",
"static",
"int",
"getOccurrenceCountIgnoreCase",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"@",
"Nullable",
"final",
"String",
"sSearch",
",",
"@",
"Nonnull",
"final",
"Locale",
"aSortLocale",
")",
"{",
"return",
"sText... | Count the number of occurrences of sSearch within sText ignoring case.
@param sText
The text to search in. May be <code>null</code>.
@param sSearch
The text to search for. May be <code>null</code>.
@param aSortLocale
The locale to be used for case unifying.
@return A non-negative number of occurrences. | [
"Count",
"the",
"number",
"of",
"occurrences",
"of",
"sSearch",
"within",
"sText",
"ignoring",
"case",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3175-L3183 |
136,767 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getOccurrenceCount | @Nonnegative
public static int getOccurrenceCount (@Nullable final String sText, final char cSearch)
{
int ret = 0;
final int nTextLength = getLength (sText);
if (nTextLength >= 1)
{
int nLastIndex = 0;
int nIndex;
do
{
// Start searching from the last result
nIndex = getIndexOf (sText, nLastIndex, cSearch);
if (nIndex != STRING_NOT_FOUND)
{
// Match found
++ret;
// Identify the next starting position (relative index + number of
// search strings)
nLastIndex = nIndex + 1;
}
} while (nIndex != STRING_NOT_FOUND);
}
return ret;
} | java | @Nonnegative
public static int getOccurrenceCount (@Nullable final String sText, final char cSearch)
{
int ret = 0;
final int nTextLength = getLength (sText);
if (nTextLength >= 1)
{
int nLastIndex = 0;
int nIndex;
do
{
// Start searching from the last result
nIndex = getIndexOf (sText, nLastIndex, cSearch);
if (nIndex != STRING_NOT_FOUND)
{
// Match found
++ret;
// Identify the next starting position (relative index + number of
// search strings)
nLastIndex = nIndex + 1;
}
} while (nIndex != STRING_NOT_FOUND);
}
return ret;
} | [
"@",
"Nonnegative",
"public",
"static",
"int",
"getOccurrenceCount",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"final",
"char",
"cSearch",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"final",
"int",
"nTextLength",
"=",
"getLength",
"(",
"sText",
")... | Count the number of occurrences of cSearch within sText.
@param sText
The text to search in. May be <code>null</code>.
@param cSearch
The character to search for.
@return A non-negative number of occurrences. | [
"Count",
"the",
"number",
"of",
"occurrences",
"of",
"cSearch",
"within",
"sText",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3194-L3219 |
136,768 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getOccurrenceCountIgnoreCase | @Nonnegative
public static int getOccurrenceCountIgnoreCase (@Nullable final String sText,
final char cSearch,
@Nonnull final Locale aSortLocale)
{
return sText != null ? getOccurrenceCount (sText.toLowerCase (aSortLocale), Character.toLowerCase (cSearch)) : 0;
} | java | @Nonnegative
public static int getOccurrenceCountIgnoreCase (@Nullable final String sText,
final char cSearch,
@Nonnull final Locale aSortLocale)
{
return sText != null ? getOccurrenceCount (sText.toLowerCase (aSortLocale), Character.toLowerCase (cSearch)) : 0;
} | [
"@",
"Nonnegative",
"public",
"static",
"int",
"getOccurrenceCountIgnoreCase",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"final",
"char",
"cSearch",
",",
"@",
"Nonnull",
"final",
"Locale",
"aSortLocale",
")",
"{",
"return",
"sText",
"!=",
"null",
... | Count the number of occurrences of cSearch within sText ignoring case.
@param sText
The text to search in. May be <code>null</code>.
@param cSearch
The character to search for.
@param aSortLocale
The locale to be used for case unifying.
@return A non-negative number of occurrences. | [
"Count",
"the",
"number",
"of",
"occurrences",
"of",
"cSearch",
"within",
"sText",
"ignoring",
"case",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3232-L3238 |
136,769 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.trimLeadingWhitespaces | @Nullable
@CheckReturnValue
public static String trimLeadingWhitespaces (@Nullable final String s)
{
final int n = getLeadingWhitespaceCount (s);
return n == 0 ? s : s.substring (n, s.length ());
} | java | @Nullable
@CheckReturnValue
public static String trimLeadingWhitespaces (@Nullable final String s)
{
final int n = getLeadingWhitespaceCount (s);
return n == 0 ? s : s.substring (n, s.length ());
} | [
"@",
"Nullable",
"@",
"CheckReturnValue",
"public",
"static",
"String",
"trimLeadingWhitespaces",
"(",
"@",
"Nullable",
"final",
"String",
"s",
")",
"{",
"final",
"int",
"n",
"=",
"getLeadingWhitespaceCount",
"(",
"s",
")",
";",
"return",
"n",
"==",
"0",
"?"... | Remove any leading whitespaces from the passed string.
@param s
the String to be trimmed
@return the original String with all leading whitespaces removed | [
"Remove",
"any",
"leading",
"whitespaces",
"from",
"the",
"passed",
"string",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3247-L3253 |
136,770 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.trimTrailingWhitespaces | @Nullable
@CheckReturnValue
public static String trimTrailingWhitespaces (@Nullable final String s)
{
final int n = getTrailingWhitespaceCount (s);
return n == 0 ? s : s.substring (0, s.length () - n);
} | java | @Nullable
@CheckReturnValue
public static String trimTrailingWhitespaces (@Nullable final String s)
{
final int n = getTrailingWhitespaceCount (s);
return n == 0 ? s : s.substring (0, s.length () - n);
} | [
"@",
"Nullable",
"@",
"CheckReturnValue",
"public",
"static",
"String",
"trimTrailingWhitespaces",
"(",
"@",
"Nullable",
"final",
"String",
"s",
")",
"{",
"final",
"int",
"n",
"=",
"getTrailingWhitespaceCount",
"(",
"s",
")",
";",
"return",
"n",
"==",
"0",
"... | Remove any trailing whitespaces from the passed string.
@param s
the String to be cut
@return the original String with all trailing whitespaces removed | [
"Remove",
"any",
"trailing",
"whitespaces",
"from",
"the",
"passed",
"string",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3262-L3268 |
136,771 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getFirstChar | public static char getFirstChar (@Nullable final CharSequence aCS)
{
return hasText (aCS) ? aCS.charAt (0) : CGlobal.ILLEGAL_CHAR;
} | java | public static char getFirstChar (@Nullable final CharSequence aCS)
{
return hasText (aCS) ? aCS.charAt (0) : CGlobal.ILLEGAL_CHAR;
} | [
"public",
"static",
"char",
"getFirstChar",
"(",
"@",
"Nullable",
"final",
"CharSequence",
"aCS",
")",
"{",
"return",
"hasText",
"(",
"aCS",
")",
"?",
"aCS",
".",
"charAt",
"(",
"0",
")",
":",
"CGlobal",
".",
"ILLEGAL_CHAR",
";",
"}"
] | Get the first character of the passed character sequence
@param aCS
The source character sequence
@return {@link CGlobal#ILLEGAL_CHAR} if the passed sequence was empty | [
"Get",
"the",
"first",
"character",
"of",
"the",
"passed",
"character",
"sequence"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3571-L3574 |
136,772 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getLastChar | public static char getLastChar (@Nullable final CharSequence aCS)
{
final int nLength = getLength (aCS);
return nLength > 0 ? aCS.charAt (nLength - 1) : CGlobal.ILLEGAL_CHAR;
} | java | public static char getLastChar (@Nullable final CharSequence aCS)
{
final int nLength = getLength (aCS);
return nLength > 0 ? aCS.charAt (nLength - 1) : CGlobal.ILLEGAL_CHAR;
} | [
"public",
"static",
"char",
"getLastChar",
"(",
"@",
"Nullable",
"final",
"CharSequence",
"aCS",
")",
"{",
"final",
"int",
"nLength",
"=",
"getLength",
"(",
"aCS",
")",
";",
"return",
"nLength",
">",
"0",
"?",
"aCS",
".",
"charAt",
"(",
"nLength",
"-",
... | Get the last character of the passed character sequence
@param aCS
The source character sequence
@return {@link CGlobal#ILLEGAL_CHAR} if the passed sequence was empty | [
"Get",
"the",
"last",
"character",
"of",
"the",
"passed",
"character",
"sequence"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3595-L3599 |
136,773 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.removeAll | @Nullable
public static String removeAll (@Nullable final String sInputString, @Nullable final String sRemoveString)
{
// Is input string empty?
if (hasNoText (sInputString))
return sInputString;
final int nRemoveLength = getLength (sRemoveString);
if (nRemoveLength == 0)
{
// Nothing to be removed
return sInputString;
}
if (nRemoveLength == 1)
{
// Shortcut to char version
return removeAll (sInputString, sRemoveString.charAt (0));
}
// Does the string occur anywhere?
int nIndex = sInputString.indexOf (sRemoveString, 0);
if (nIndex == STRING_NOT_FOUND)
return sInputString;
// build output buffer
final StringBuilder ret = new StringBuilder (sInputString.length ());
int nOldIndex = 0;
do
{
ret.append (sInputString, nOldIndex, nIndex);
nOldIndex = nIndex + nRemoveLength;
nIndex = sInputString.indexOf (sRemoveString, nOldIndex);
} while (nIndex != STRING_NOT_FOUND);
ret.append (sInputString, nOldIndex, sInputString.length ());
return ret.toString ();
} | java | @Nullable
public static String removeAll (@Nullable final String sInputString, @Nullable final String sRemoveString)
{
// Is input string empty?
if (hasNoText (sInputString))
return sInputString;
final int nRemoveLength = getLength (sRemoveString);
if (nRemoveLength == 0)
{
// Nothing to be removed
return sInputString;
}
if (nRemoveLength == 1)
{
// Shortcut to char version
return removeAll (sInputString, sRemoveString.charAt (0));
}
// Does the string occur anywhere?
int nIndex = sInputString.indexOf (sRemoveString, 0);
if (nIndex == STRING_NOT_FOUND)
return sInputString;
// build output buffer
final StringBuilder ret = new StringBuilder (sInputString.length ());
int nOldIndex = 0;
do
{
ret.append (sInputString, nOldIndex, nIndex);
nOldIndex = nIndex + nRemoveLength;
nIndex = sInputString.indexOf (sRemoveString, nOldIndex);
} while (nIndex != STRING_NOT_FOUND);
ret.append (sInputString, nOldIndex, sInputString.length ());
return ret.toString ();
} | [
"@",
"Nullable",
"public",
"static",
"String",
"removeAll",
"(",
"@",
"Nullable",
"final",
"String",
"sInputString",
",",
"@",
"Nullable",
"final",
"String",
"sRemoveString",
")",
"{",
"// Is input string empty?",
"if",
"(",
"hasNoText",
"(",
"sInputString",
")",
... | Remove all occurrences of the passed character from the specified input
string
@param sInputString
The input string where the character should be removed. If this
parameter is <code>null</code> or empty, no removing is done.
@param sRemoveString
The String to be removed. May be <code>null</code> or empty in which
case nothing happens.
@return The input string as is, if the input string is empty or if the remove
string is empty or not contained. | [
"Remove",
"all",
"occurrences",
"of",
"the",
"passed",
"character",
"from",
"the",
"specified",
"input",
"string"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L4447-L4483 |
136,774 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getWithoutLeadingChars | @Nonnull
public static String getWithoutLeadingChars (@Nullable final String sStr, @Nonnegative final int nCount)
{
ValueEnforcer.isGE0 (nCount, "Count");
if (nCount == 0)
return sStr;
return getLength (sStr) <= nCount ? "" : sStr.substring (nCount);
} | java | @Nonnull
public static String getWithoutLeadingChars (@Nullable final String sStr, @Nonnegative final int nCount)
{
ValueEnforcer.isGE0 (nCount, "Count");
if (nCount == 0)
return sStr;
return getLength (sStr) <= nCount ? "" : sStr.substring (nCount);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getWithoutLeadingChars",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"@",
"Nonnegative",
"final",
"int",
"nCount",
")",
"{",
"ValueEnforcer",
".",
"isGE0",
"(",
"nCount",
",",
"\"Count\"",
")",
";",
"i... | Get the passed string without the specified number of leading chars.
@param sStr
The source string. May be <code>null</code>.
@param nCount
The number of chars to remove.
@return An empty, non-<code>null</code> string if the passed string has a
length ≤ <code>nCount</code>. | [
"Get",
"the",
"passed",
"string",
"without",
"the",
"specified",
"number",
"of",
"leading",
"chars",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L4666-L4674 |
136,775 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getWithoutTrailingChars | @Nonnull
public static String getWithoutTrailingChars (@Nullable final String sStr, @Nonnegative final int nCount)
{
ValueEnforcer.isGE0 (nCount, "Count");
if (nCount == 0)
return sStr;
final int nLength = getLength (sStr);
return nLength <= nCount ? "" : sStr.substring (0, nLength - nCount);
} | java | @Nonnull
public static String getWithoutTrailingChars (@Nullable final String sStr, @Nonnegative final int nCount)
{
ValueEnforcer.isGE0 (nCount, "Count");
if (nCount == 0)
return sStr;
final int nLength = getLength (sStr);
return nLength <= nCount ? "" : sStr.substring (0, nLength - nCount);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getWithoutTrailingChars",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"@",
"Nonnegative",
"final",
"int",
"nCount",
")",
"{",
"ValueEnforcer",
".",
"isGE0",
"(",
"nCount",
",",
"\"Count\"",
")",
";",
"... | Get the passed string without the specified number of trailing chars.
@param sStr
The source string. May be <code>null</code>.
@param nCount
The number of chars to remove.
@return An empty, non-<code>null</code> string if the passed string has a
length ≤ <code>nCount</code>. | [
"Get",
"the",
"passed",
"string",
"without",
"the",
"specified",
"number",
"of",
"trailing",
"chars",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L4700-L4709 |
136,776 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.removeMultiple | @Nonnull
public static String removeMultiple (@Nullable final String sInputString, @Nonnull final char [] aRemoveChars)
{
ValueEnforcer.notNull (aRemoveChars, "RemoveChars");
// Any input text?
if (hasNoText (sInputString))
return "";
// Anything to remove?
if (aRemoveChars.length == 0)
return sInputString;
final StringBuilder aSB = new StringBuilder (sInputString.length ());
iterateChars (sInputString, cInput -> {
if (!ArrayHelper.contains (aRemoveChars, cInput))
aSB.append (cInput);
});
return aSB.toString ();
} | java | @Nonnull
public static String removeMultiple (@Nullable final String sInputString, @Nonnull final char [] aRemoveChars)
{
ValueEnforcer.notNull (aRemoveChars, "RemoveChars");
// Any input text?
if (hasNoText (sInputString))
return "";
// Anything to remove?
if (aRemoveChars.length == 0)
return sInputString;
final StringBuilder aSB = new StringBuilder (sInputString.length ());
iterateChars (sInputString, cInput -> {
if (!ArrayHelper.contains (aRemoveChars, cInput))
aSB.append (cInput);
});
return aSB.toString ();
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"removeMultiple",
"(",
"@",
"Nullable",
"final",
"String",
"sInputString",
",",
"@",
"Nonnull",
"final",
"char",
"[",
"]",
"aRemoveChars",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aRemoveChars",
",",
"\"Rem... | Optimized remove method that removes a set of characters from an input
string!
@param sInputString
The input string.
@param aRemoveChars
The characters to remove. May not be <code>null</code>.
@return The version of the string without the passed characters or an empty
String if the input string was <code>null</code>. | [
"Optimized",
"remove",
"method",
"that",
"removes",
"a",
"set",
"of",
"characters",
"from",
"an",
"input",
"string!"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L5196-L5215 |
136,777 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.iterateChars | public static void iterateChars (@Nullable final String sInputString, @Nonnull final ICharConsumer aConsumer)
{
ValueEnforcer.notNull (aConsumer, "Consumer");
if (sInputString != null)
{
final char [] aInput = sInputString.toCharArray ();
for (final char cInput : aInput)
aConsumer.accept (cInput);
}
} | java | public static void iterateChars (@Nullable final String sInputString, @Nonnull final ICharConsumer aConsumer)
{
ValueEnforcer.notNull (aConsumer, "Consumer");
if (sInputString != null)
{
final char [] aInput = sInputString.toCharArray ();
for (final char cInput : aInput)
aConsumer.accept (cInput);
}
} | [
"public",
"static",
"void",
"iterateChars",
"(",
"@",
"Nullable",
"final",
"String",
"sInputString",
",",
"@",
"Nonnull",
"final",
"ICharConsumer",
"aConsumer",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aConsumer",
",",
"\"Consumer\"",
")",
";",
"if",
"... | Iterate all characters and pass them to the provided consumer.
@param sInputString
Input String to use. May be <code>null</code> or empty.
@param aConsumer
The consumer to be used. May not be <code>null</code>. | [
"Iterate",
"all",
"characters",
"and",
"pass",
"them",
"to",
"the",
"provided",
"consumer",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L5225-L5235 |
136,778 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/url/URLProtocolRegistry.java | URLProtocolRegistry.registerProtocol | public void registerProtocol (@Nonnull final IURLProtocol aProtocol)
{
ValueEnforcer.notNull (aProtocol, "Protocol");
final String sProtocol = aProtocol.getProtocol ();
m_aRWLock.writeLocked ( () -> {
if (m_aProtocols.containsKey (sProtocol))
throw new IllegalArgumentException ("Another handler for protocol '" + sProtocol + "' is already registered!");
m_aProtocols.put (sProtocol, aProtocol);
});
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Registered new custom URL protocol: " + aProtocol);
} | java | public void registerProtocol (@Nonnull final IURLProtocol aProtocol)
{
ValueEnforcer.notNull (aProtocol, "Protocol");
final String sProtocol = aProtocol.getProtocol ();
m_aRWLock.writeLocked ( () -> {
if (m_aProtocols.containsKey (sProtocol))
throw new IllegalArgumentException ("Another handler for protocol '" + sProtocol + "' is already registered!");
m_aProtocols.put (sProtocol, aProtocol);
});
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Registered new custom URL protocol: " + aProtocol);
} | [
"public",
"void",
"registerProtocol",
"(",
"@",
"Nonnull",
"final",
"IURLProtocol",
"aProtocol",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aProtocol",
",",
"\"Protocol\"",
")",
";",
"final",
"String",
"sProtocol",
"=",
"aProtocol",
".",
"getProtocol",
"("... | Registers a new protocol
@param aProtocol
The protocol to be registered. May not be <code>null</code>.
@throws IllegalArgumentException
If another handler for this protocol is already installed. | [
"Registers",
"a",
"new",
"protocol"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/url/URLProtocolRegistry.java#L91-L104 |
136,779 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java | StreamHelper.isKnownEOFException | public static boolean isKnownEOFException (@Nullable final Class <?> aClass)
{
if (aClass == null)
return false;
final String sClass = aClass.getName ();
return sClass.equals ("java.io.EOFException") ||
sClass.equals ("org.mortbay.jetty.EofException") ||
sClass.equals ("org.eclipse.jetty.io.EofException") ||
sClass.equals ("org.apache.catalina.connector.ClientAbortException");
} | java | public static boolean isKnownEOFException (@Nullable final Class <?> aClass)
{
if (aClass == null)
return false;
final String sClass = aClass.getName ();
return sClass.equals ("java.io.EOFException") ||
sClass.equals ("org.mortbay.jetty.EofException") ||
sClass.equals ("org.eclipse.jetty.io.EofException") ||
sClass.equals ("org.apache.catalina.connector.ClientAbortException");
} | [
"public",
"static",
"boolean",
"isKnownEOFException",
"(",
"@",
"Nullable",
"final",
"Class",
"<",
"?",
">",
"aClass",
")",
"{",
"if",
"(",
"aClass",
"==",
"null",
")",
"return",
"false",
";",
"final",
"String",
"sClass",
"=",
"aClass",
".",
"getName",
"... | Check if the passed class is a known EOF exception class.
@param aClass
The class to be checked. May be <code>null</code>.
@return <code>true</code> if it is a known EOF exception class. | [
"Check",
"if",
"the",
"passed",
"class",
"is",
"a",
"known",
"EOF",
"exception",
"class",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L117-L127 |
136,780 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java | StreamHelper.closeWithoutFlush | @Nonnull
public static ESuccess closeWithoutFlush (@Nullable @WillClose final AutoCloseable aCloseable)
{
if (aCloseable != null)
{
try
{
// close stream
aCloseable.close ();
return ESuccess.SUCCESS;
}
catch (final Exception ex)
{
if (!isKnownEOFException (ex))
LOGGER.error ("Failed to close object " + aCloseable.getClass ().getName (),
ex instanceof IMockException ? null : ex);
}
}
return ESuccess.FAILURE;
} | java | @Nonnull
public static ESuccess closeWithoutFlush (@Nullable @WillClose final AutoCloseable aCloseable)
{
if (aCloseable != null)
{
try
{
// close stream
aCloseable.close ();
return ESuccess.SUCCESS;
}
catch (final Exception ex)
{
if (!isKnownEOFException (ex))
LOGGER.error ("Failed to close object " + aCloseable.getClass ().getName (),
ex instanceof IMockException ? null : ex);
}
}
return ESuccess.FAILURE;
} | [
"@",
"Nonnull",
"public",
"static",
"ESuccess",
"closeWithoutFlush",
"(",
"@",
"Nullable",
"@",
"WillClose",
"final",
"AutoCloseable",
"aCloseable",
")",
"{",
"if",
"(",
"aCloseable",
"!=",
"null",
")",
"{",
"try",
"{",
"// close stream",
"aCloseable",
".",
"c... | Close the passed object, without trying to call flush on it.
@param aCloseable
The object to be closed. May be <code>null</code>.
@return {@link ESuccess#SUCCESS} if the object was successfully closed. | [
"Close",
"the",
"passed",
"object",
"without",
"trying",
"to",
"call",
"flush",
"on",
"it",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L136-L155 |
136,781 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java | StreamHelper.copyInputStreamToOutputStreamAndCloseOS | @Nonnull
public static ESuccess copyInputStreamToOutputStreamAndCloseOS (@WillClose @Nullable final InputStream aIS,
@WillClose @Nullable final OutputStream aOS)
{
try
{
return copyInputStreamToOutputStream (aIS, aOS, new byte [DEFAULT_BUFSIZE], (MutableLong) null, (Long) null);
}
finally
{
close (aOS);
}
} | java | @Nonnull
public static ESuccess copyInputStreamToOutputStreamAndCloseOS (@WillClose @Nullable final InputStream aIS,
@WillClose @Nullable final OutputStream aOS)
{
try
{
return copyInputStreamToOutputStream (aIS, aOS, new byte [DEFAULT_BUFSIZE], (MutableLong) null, (Long) null);
}
finally
{
close (aOS);
}
} | [
"@",
"Nonnull",
"public",
"static",
"ESuccess",
"copyInputStreamToOutputStreamAndCloseOS",
"(",
"@",
"WillClose",
"@",
"Nullable",
"final",
"InputStream",
"aIS",
",",
"@",
"WillClose",
"@",
"Nullable",
"final",
"OutputStream",
"aOS",
")",
"{",
"try",
"{",
"return"... | Pass the content of the given input stream to the given output stream. Both
the input stream and the output stream are automatically closed.
@param aIS
The input stream to read from. May be <code>null</code>. Automatically
closed!
@param aOS
The output stream to write to. May be <code>null</code>. Automatically
closed!
@return <code>{@link ESuccess#SUCCESS}</code> if copying took place, <code>
{@link ESuccess#FAILURE}</code> otherwise | [
"Pass",
"the",
"content",
"of",
"the",
"given",
"input",
"stream",
"to",
"the",
"given",
"output",
"stream",
".",
"Both",
"the",
"input",
"stream",
"and",
"the",
"output",
"stream",
"are",
"automatically",
"closed",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L239-L251 |
136,782 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java | StreamHelper.getAvailable | public static int getAvailable (@Nullable final InputStream aIS)
{
if (aIS != null)
try
{
return aIS.available ();
}
catch (final IOException ex)
{
// Fall through
}
return 0;
} | java | public static int getAvailable (@Nullable final InputStream aIS)
{
if (aIS != null)
try
{
return aIS.available ();
}
catch (final IOException ex)
{
// Fall through
}
return 0;
} | [
"public",
"static",
"int",
"getAvailable",
"(",
"@",
"Nullable",
"final",
"InputStream",
"aIS",
")",
"{",
"if",
"(",
"aIS",
"!=",
"null",
")",
"try",
"{",
"return",
"aIS",
".",
"available",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"ex"... | Get the number of available bytes in the passed input stream.
@param aIS
The input stream to use. May be <code>null</code>.
@return 0 in case of an error or if the parameter was <code>null</code>. | [
"Get",
"the",
"number",
"of",
"available",
"bytes",
"in",
"the",
"passed",
"input",
"stream",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L531-L543 |
136,783 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java | StreamHelper.copyReaderToWriterWithLimitAndCloseWriter | @Nonnull
public static ESuccess copyReaderToWriterWithLimitAndCloseWriter (@Nullable @WillClose final Reader aReader,
@Nullable @WillClose final Writer aWriter,
@Nonnegative final long nLimit)
{
try
{
return copyReaderToWriter (aReader,
aWriter,
new char [DEFAULT_BUFSIZE],
(MutableLong) null,
Long.valueOf (nLimit));
}
finally
{
close (aWriter);
}
} | java | @Nonnull
public static ESuccess copyReaderToWriterWithLimitAndCloseWriter (@Nullable @WillClose final Reader aReader,
@Nullable @WillClose final Writer aWriter,
@Nonnegative final long nLimit)
{
try
{
return copyReaderToWriter (aReader,
aWriter,
new char [DEFAULT_BUFSIZE],
(MutableLong) null,
Long.valueOf (nLimit));
}
finally
{
close (aWriter);
}
} | [
"@",
"Nonnull",
"public",
"static",
"ESuccess",
"copyReaderToWriterWithLimitAndCloseWriter",
"(",
"@",
"Nullable",
"@",
"WillClose",
"final",
"Reader",
"aReader",
",",
"@",
"Nullable",
"@",
"WillClose",
"final",
"Writer",
"aWriter",
",",
"@",
"Nonnegative",
"final",... | Pass the content of the given reader to the given writer. The reader and the
writer are automatically closed!
@param aReader
The reader to read from. May be <code>null</code>. Automatically
closed!
@param aWriter
The writer to write to. May be <code>null</code>. Automatically
closed!
@param nLimit
The maximum number of chars to be copied to the writer. Must be ≥
0.
@return <code>{@link ESuccess#SUCCESS}</code> if copying took place, <code>
{@link ESuccess#FAILURE}</code> otherwise | [
"Pass",
"the",
"content",
"of",
"the",
"given",
"reader",
"to",
"the",
"given",
"writer",
".",
"The",
"reader",
"and",
"the",
"writer",
"are",
"automatically",
"closed!"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L706-L723 |
136,784 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java | StreamHelper.getAllCharacters | @Nullable
public static char [] getAllCharacters (@Nullable @WillClose final Reader aReader)
{
if (aReader == null)
return null;
return getCopy (aReader).getAsCharArray ();
} | java | @Nullable
public static char [] getAllCharacters (@Nullable @WillClose final Reader aReader)
{
if (aReader == null)
return null;
return getCopy (aReader).getAsCharArray ();
} | [
"@",
"Nullable",
"public",
"static",
"char",
"[",
"]",
"getAllCharacters",
"(",
"@",
"Nullable",
"@",
"WillClose",
"final",
"Reader",
"aReader",
")",
"{",
"if",
"(",
"aReader",
"==",
"null",
")",
"return",
"null",
";",
"return",
"getCopy",
"(",
"aReader",
... | Read all characters from the passed reader into a char array.
@param aReader
The reader to read from. May be <code>null</code>.
@return The character array or <code>null</code> if the reader is
<code>null</code>. | [
"Read",
"all",
"characters",
"from",
"the",
"passed",
"reader",
"into",
"a",
"char",
"array",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L982-L989 |
136,785 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java | StreamHelper.getAllCharactersAsString | @Nullable
public static String getAllCharactersAsString (@Nullable @WillClose final Reader aReader)
{
if (aReader == null)
return null;
return getCopy (aReader).getAsString ();
} | java | @Nullable
public static String getAllCharactersAsString (@Nullable @WillClose final Reader aReader)
{
if (aReader == null)
return null;
return getCopy (aReader).getAsString ();
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getAllCharactersAsString",
"(",
"@",
"Nullable",
"@",
"WillClose",
"final",
"Reader",
"aReader",
")",
"{",
"if",
"(",
"aReader",
"==",
"null",
")",
"return",
"null",
";",
"return",
"getCopy",
"(",
"aReader",
")... | Read all characters from the passed reader into a String.
@param aReader
The reader to read from. May be <code>null</code>.
@return The character array or <code>null</code> if the reader is
<code>null</code>. | [
"Read",
"all",
"characters",
"from",
"the",
"passed",
"reader",
"into",
"a",
"String",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L999-L1006 |
136,786 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java | StreamHelper.readStreamLines | public static void readStreamLines (@WillClose @Nullable final InputStream aIS,
@Nonnull @Nonempty final Charset aCharset,
@Nonnull final Consumer <? super String> aLineCallback)
{
if (aIS != null)
readStreamLines (aIS, aCharset, 0, CGlobal.ILLEGAL_UINT, aLineCallback);
} | java | public static void readStreamLines (@WillClose @Nullable final InputStream aIS,
@Nonnull @Nonempty final Charset aCharset,
@Nonnull final Consumer <? super String> aLineCallback)
{
if (aIS != null)
readStreamLines (aIS, aCharset, 0, CGlobal.ILLEGAL_UINT, aLineCallback);
} | [
"public",
"static",
"void",
"readStreamLines",
"(",
"@",
"WillClose",
"@",
"Nullable",
"final",
"InputStream",
"aIS",
",",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"Charset",
"aCharset",
",",
"@",
"Nonnull",
"final",
"Consumer",
"<",
"?",
"super",
"String",
... | Read the complete content of the passed stream and pass each line separately
to the passed callback.
@param aIS
The input stream to read from. May be <code>null</code>.
@param aCharset
The character set to use. May not be <code>null</code>.
@param aLineCallback
The callback that is invoked for all read lines. Each passed line does
NOT contain the line delimiter! | [
"Read",
"the",
"complete",
"content",
"of",
"the",
"passed",
"stream",
"and",
"pass",
"each",
"line",
"separately",
"to",
"the",
"passed",
"callback",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L1142-L1148 |
136,787 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java | StreamHelper.readStreamLines | public static void readStreamLines (@WillClose @Nullable final InputStream aIS,
@Nonnull @Nonempty final Charset aCharset,
@Nonnegative final int nLinesToSkip,
final int nLinesToRead,
@Nonnull final Consumer <? super String> aLineCallback)
{
try
{
ValueEnforcer.notNull (aCharset, "Charset");
ValueEnforcer.isGE0 (nLinesToSkip, "LinesToSkip");
final boolean bReadAllLines = nLinesToRead == CGlobal.ILLEGAL_UINT;
ValueEnforcer.isTrue (bReadAllLines || nLinesToRead >= 0,
() -> "Line count may not be that negative: " + nLinesToRead);
ValueEnforcer.notNull (aLineCallback, "LineCallback");
// Start the action only if there is something to read
if (aIS != null)
if (bReadAllLines || nLinesToRead > 0)
{
try (final NonBlockingBufferedReader aBR = new NonBlockingBufferedReader (createReader (aIS, aCharset)))
{
// read with the passed charset
_readFromReader (nLinesToSkip, nLinesToRead, aLineCallback, bReadAllLines, aBR);
}
catch (final IOException ex)
{
LOGGER.error ("Failed to read from input stream", ex instanceof IMockException ? null : ex);
}
}
}
finally
{
// Close input stream in case something went wrong with the buffered
// reader.
close (aIS);
}
} | java | public static void readStreamLines (@WillClose @Nullable final InputStream aIS,
@Nonnull @Nonempty final Charset aCharset,
@Nonnegative final int nLinesToSkip,
final int nLinesToRead,
@Nonnull final Consumer <? super String> aLineCallback)
{
try
{
ValueEnforcer.notNull (aCharset, "Charset");
ValueEnforcer.isGE0 (nLinesToSkip, "LinesToSkip");
final boolean bReadAllLines = nLinesToRead == CGlobal.ILLEGAL_UINT;
ValueEnforcer.isTrue (bReadAllLines || nLinesToRead >= 0,
() -> "Line count may not be that negative: " + nLinesToRead);
ValueEnforcer.notNull (aLineCallback, "LineCallback");
// Start the action only if there is something to read
if (aIS != null)
if (bReadAllLines || nLinesToRead > 0)
{
try (final NonBlockingBufferedReader aBR = new NonBlockingBufferedReader (createReader (aIS, aCharset)))
{
// read with the passed charset
_readFromReader (nLinesToSkip, nLinesToRead, aLineCallback, bReadAllLines, aBR);
}
catch (final IOException ex)
{
LOGGER.error ("Failed to read from input stream", ex instanceof IMockException ? null : ex);
}
}
}
finally
{
// Close input stream in case something went wrong with the buffered
// reader.
close (aIS);
}
} | [
"public",
"static",
"void",
"readStreamLines",
"(",
"@",
"WillClose",
"@",
"Nullable",
"final",
"InputStream",
"aIS",
",",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"Charset",
"aCharset",
",",
"@",
"Nonnegative",
"final",
"int",
"nLinesToSkip",
",",
"final",
"... | Read the content of the passed stream line by line and invoking a callback on
all matching lines.
@param aIS
The input stream to read from. May be <code>null</code>.
@param aCharset
The character set to use. May not be <code>null</code>.
@param nLinesToSkip
The 0-based index of the first line to read. Pass in 0 to indicate to
read everything.
@param nLinesToRead
The number of lines to read. Pass in {@link CGlobal#ILLEGAL_UINT} to
indicate that all lines should be read. If the number passed here
exceeds the number of lines in the file, nothing happens.
@param aLineCallback
The callback that is invoked for all read lines. Each passed line does
NOT contain the line delimiter! Note: it is not invoked for skipped
lines! | [
"Read",
"the",
"content",
"of",
"the",
"passed",
"stream",
"line",
"by",
"line",
"and",
"invoking",
"a",
"callback",
"on",
"all",
"matching",
"lines",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L1213-L1249 |
136,788 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java | StreamHelper.skipFully | public static void skipFully (@Nonnull final InputStream aIS, @Nonnegative final long nBytesToSkip) throws IOException
{
ValueEnforcer.notNull (aIS, "InputStream");
ValueEnforcer.isGE0 (nBytesToSkip, "BytesToSkip");
long nRemaining = nBytesToSkip;
while (nRemaining > 0)
{
// May only return a partial skip
final long nSkipped = aIS.skip (nRemaining);
if (nSkipped == 0)
{
// Check if we're at the end of the file or not
// -> blocking read!
if (aIS.read () == -1)
{
throw new EOFException ("Failed to skip a total of " +
nBytesToSkip +
" bytes on input stream. Only skipped " +
(nBytesToSkip - nRemaining) +
" bytes so far!");
}
nRemaining--;
}
else
{
// Skipped at least one char
nRemaining -= nSkipped;
}
}
} | java | public static void skipFully (@Nonnull final InputStream aIS, @Nonnegative final long nBytesToSkip) throws IOException
{
ValueEnforcer.notNull (aIS, "InputStream");
ValueEnforcer.isGE0 (nBytesToSkip, "BytesToSkip");
long nRemaining = nBytesToSkip;
while (nRemaining > 0)
{
// May only return a partial skip
final long nSkipped = aIS.skip (nRemaining);
if (nSkipped == 0)
{
// Check if we're at the end of the file or not
// -> blocking read!
if (aIS.read () == -1)
{
throw new EOFException ("Failed to skip a total of " +
nBytesToSkip +
" bytes on input stream. Only skipped " +
(nBytesToSkip - nRemaining) +
" bytes so far!");
}
nRemaining--;
}
else
{
// Skipped at least one char
nRemaining -= nSkipped;
}
}
} | [
"public",
"static",
"void",
"skipFully",
"(",
"@",
"Nonnull",
"final",
"InputStream",
"aIS",
",",
"@",
"Nonnegative",
"final",
"long",
"nBytesToSkip",
")",
"throws",
"IOException",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aIS",
",",
"\"InputStream\"",
")",
... | Fully skip the passed amounts in the input stream. Only forward skipping is
possible!
@param aIS
The input stream to skip in.
@param nBytesToSkip
The number of bytes to skip. Must be ≥ 0.
@throws IOException
In case something goes wrong internally | [
"Fully",
"skip",
"the",
"passed",
"amounts",
"in",
"the",
"input",
"stream",
".",
"Only",
"forward",
"skipping",
"is",
"possible!"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L1369-L1399 |
136,789 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/concurrent/collector/ConcurrentCollectorMultiple.java | ConcurrentCollectorMultiple._perform | @Nonnull
private ESuccess _perform (@Nonnull final List <DATATYPE> aObjectsToPerform)
{
if (!aObjectsToPerform.isEmpty ())
{
try
{
// Perform the action on the objects, regardless of whether a
// "stop queue message" was received or not
m_aPerformer.runAsync (aObjectsToPerform);
}
catch (final Exception ex)
{
LOGGER.error ("Failed to perform actions on " +
aObjectsToPerform.size () +
" objects with performer " +
m_aPerformer +
" - objects are lost!",
ex);
return ESuccess.FAILURE;
}
// clear perform-list anyway
aObjectsToPerform.clear ();
}
return ESuccess.SUCCESS;
} | java | @Nonnull
private ESuccess _perform (@Nonnull final List <DATATYPE> aObjectsToPerform)
{
if (!aObjectsToPerform.isEmpty ())
{
try
{
// Perform the action on the objects, regardless of whether a
// "stop queue message" was received or not
m_aPerformer.runAsync (aObjectsToPerform);
}
catch (final Exception ex)
{
LOGGER.error ("Failed to perform actions on " +
aObjectsToPerform.size () +
" objects with performer " +
m_aPerformer +
" - objects are lost!",
ex);
return ESuccess.FAILURE;
}
// clear perform-list anyway
aObjectsToPerform.clear ();
}
return ESuccess.SUCCESS;
} | [
"@",
"Nonnull",
"private",
"ESuccess",
"_perform",
"(",
"@",
"Nonnull",
"final",
"List",
"<",
"DATATYPE",
">",
"aObjectsToPerform",
")",
"{",
"if",
"(",
"!",
"aObjectsToPerform",
".",
"isEmpty",
"(",
")",
")",
"{",
"try",
"{",
"// Perform the action on the obj... | Internal method to invoke the performed for the passed list of objects.
@param aObjectsToPerform
List of objects to be passed to the performer. Never
<code>null</code>. The length is at last
{@link #getMaxPerformCount()}.
@return {@link ESuccess} | [
"Internal",
"method",
"to",
"invoke",
"the",
"performed",
"for",
"the",
"passed",
"list",
"of",
"objects",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/concurrent/collector/ConcurrentCollectorMultiple.java#L164-L191 |
136,790 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/csv/CSVParser.java | CSVParser._anyCharactersAreTheSame | private boolean _anyCharactersAreTheSame ()
{
return _isSameCharacter (m_cSeparatorChar, m_cQuoteChar) ||
_isSameCharacter (m_cSeparatorChar, m_cEscapeChar) ||
_isSameCharacter (m_cQuoteChar, m_cEscapeChar);
} | java | private boolean _anyCharactersAreTheSame ()
{
return _isSameCharacter (m_cSeparatorChar, m_cQuoteChar) ||
_isSameCharacter (m_cSeparatorChar, m_cEscapeChar) ||
_isSameCharacter (m_cQuoteChar, m_cEscapeChar);
} | [
"private",
"boolean",
"_anyCharactersAreTheSame",
"(",
")",
"{",
"return",
"_isSameCharacter",
"(",
"m_cSeparatorChar",
",",
"m_cQuoteChar",
")",
"||",
"_isSameCharacter",
"(",
"m_cSeparatorChar",
",",
"m_cEscapeChar",
")",
"||",
"_isSameCharacter",
"(",
"m_cQuoteChar",... | checks to see if any two of the three characters are the same. This is
because in openCSV the separator, quote, and escape characters must the
different.
@return <code>true</code> if any two of the three are the same. | [
"checks",
"to",
"see",
"if",
"any",
"two",
"of",
"the",
"three",
"characters",
"are",
"the",
"same",
".",
"This",
"is",
"because",
"in",
"openCSV",
"the",
"separator",
"quote",
"and",
"escape",
"characters",
"must",
"the",
"different",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/csv/CSVParser.java#L244-L249 |
136,791 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/csv/CSVParser.java | CSVParser.parseLineMulti | @Nullable
public ICommonsList <String> parseLineMulti (@Nullable final String sNextLine) throws IOException
{
return _parseLine (sNextLine, true);
} | java | @Nullable
public ICommonsList <String> parseLineMulti (@Nullable final String sNextLine) throws IOException
{
return _parseLine (sNextLine, true);
} | [
"@",
"Nullable",
"public",
"ICommonsList",
"<",
"String",
">",
"parseLineMulti",
"(",
"@",
"Nullable",
"final",
"String",
"sNextLine",
")",
"throws",
"IOException",
"{",
"return",
"_parseLine",
"(",
"sNextLine",
",",
"true",
")",
";",
"}"
] | Parses an incoming String and returns an array of elements. This method is
used when the data spans multiple lines.
@param sNextLine
current line to be processed
@return the tokenized list of elements, or <code>null</code> if nextLine is
<code>null</code>
@throws IOException
if bad things happen during the read | [
"Parses",
"an",
"incoming",
"String",
"and",
"returns",
"an",
"array",
"of",
"elements",
".",
"This",
"method",
"is",
"used",
"when",
"the",
"data",
"spans",
"multiple",
"lines",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/csv/CSVParser.java#L286-L290 |
136,792 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/csv/CSVParser.java | CSVParser.parseLine | @Nullable
public ICommonsList <String> parseLine (@Nullable final String sNextLine) throws IOException
{
return _parseLine (sNextLine, false);
} | java | @Nullable
public ICommonsList <String> parseLine (@Nullable final String sNextLine) throws IOException
{
return _parseLine (sNextLine, false);
} | [
"@",
"Nullable",
"public",
"ICommonsList",
"<",
"String",
">",
"parseLine",
"(",
"@",
"Nullable",
"final",
"String",
"sNextLine",
")",
"throws",
"IOException",
"{",
"return",
"_parseLine",
"(",
"sNextLine",
",",
"false",
")",
";",
"}"
] | Parses an incoming String and returns an array of elements. This method is
used when all data is contained in a single line.
@param sNextLine
Line to be parsed.
@return the tokenized list of elements, or <code>null</code> if nextLine is
<code>null</code>
@throws IOException
if bad things happen during the read | [
"Parses",
"an",
"incoming",
"String",
"and",
"returns",
"an",
"array",
"of",
"elements",
".",
"This",
"method",
"is",
"used",
"when",
"all",
"data",
"is",
"contained",
"in",
"a",
"single",
"line",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/csv/CSVParser.java#L303-L307 |
136,793 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriter.java | XMLWriter.getNodeAsString | @Nullable
public static String getNodeAsString (@Nonnull final Node aNode, @Nonnull final IXMLWriterSettings aSettings)
{
// start serializing
try (final NonBlockingStringWriter aWriter = new NonBlockingStringWriter (50 * CGlobal.BYTES_PER_KILOBYTE))
{
if (writeToWriter (aNode, aWriter, aSettings).isSuccess ())
{
s_aSizeHdl.addSize (aWriter.size ());
return aWriter.getAsString ();
}
}
catch (final Exception ex)
{
if (LOGGER.isErrorEnabled ())
LOGGER.error ("Error serializing DOM node with settings " + aSettings.toString (), ex);
}
return null;
} | java | @Nullable
public static String getNodeAsString (@Nonnull final Node aNode, @Nonnull final IXMLWriterSettings aSettings)
{
// start serializing
try (final NonBlockingStringWriter aWriter = new NonBlockingStringWriter (50 * CGlobal.BYTES_PER_KILOBYTE))
{
if (writeToWriter (aNode, aWriter, aSettings).isSuccess ())
{
s_aSizeHdl.addSize (aWriter.size ());
return aWriter.getAsString ();
}
}
catch (final Exception ex)
{
if (LOGGER.isErrorEnabled ())
LOGGER.error ("Error serializing DOM node with settings " + aSettings.toString (), ex);
}
return null;
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getNodeAsString",
"(",
"@",
"Nonnull",
"final",
"Node",
"aNode",
",",
"@",
"Nonnull",
"final",
"IXMLWriterSettings",
"aSettings",
")",
"{",
"// start serializing",
"try",
"(",
"final",
"NonBlockingStringWriter",
"aWrit... | Convert the passed DOM node to an XML string using the provided XML writer
settings.
@param aNode
The node to be converted to a string. May not be <code>null</code> .
@param aSettings
The XML writer settings to be used. May not be <code>null</code>.
@return The string representation of the passed node.
@since 8.6.3 | [
"Convert",
"the",
"passed",
"DOM",
"node",
"to",
"an",
"XML",
"string",
"using",
"the",
"provided",
"XML",
"writer",
"settings",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriter.java#L202-L220 |
136,794 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mock/CommonsMock.java | MockSupplier.createConstant | @Nonnull
public static MockSupplier createConstant (@Nonnull final Object aConstant)
{
ValueEnforcer.notNull (aConstant, "Constant");
return new MockSupplier (aConstant.getClass (), null, aParam -> aConstant);
} | java | @Nonnull
public static MockSupplier createConstant (@Nonnull final Object aConstant)
{
ValueEnforcer.notNull (aConstant, "Constant");
return new MockSupplier (aConstant.getClass (), null, aParam -> aConstant);
} | [
"@",
"Nonnull",
"public",
"static",
"MockSupplier",
"createConstant",
"(",
"@",
"Nonnull",
"final",
"Object",
"aConstant",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aConstant",
",",
"\"Constant\"",
")",
";",
"return",
"new",
"MockSupplier",
"(",
"aConstan... | Create a mock supplier for a constant value.
@param aConstant
The constant value to be returned. May not be <code>null</code>.
@return Never <code>null</code>. | [
"Create",
"a",
"mock",
"supplier",
"for",
"a",
"constant",
"value",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mock/CommonsMock.java#L212-L217 |
136,795 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mock/CommonsMock.java | MockSupplier.createNoParams | @Nonnull
public static <T> MockSupplier createNoParams (@Nonnull final Class <T> aDstClass,
@Nonnull final Supplier <T> aSupplier)
{
ValueEnforcer.notNull (aDstClass, "DstClass");
ValueEnforcer.notNull (aSupplier, "Supplier");
return new MockSupplier (aDstClass, null, aParam -> aSupplier.get ());
} | java | @Nonnull
public static <T> MockSupplier createNoParams (@Nonnull final Class <T> aDstClass,
@Nonnull final Supplier <T> aSupplier)
{
ValueEnforcer.notNull (aDstClass, "DstClass");
ValueEnforcer.notNull (aSupplier, "Supplier");
return new MockSupplier (aDstClass, null, aParam -> aSupplier.get ());
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"T",
">",
"MockSupplier",
"createNoParams",
"(",
"@",
"Nonnull",
"final",
"Class",
"<",
"T",
">",
"aDstClass",
",",
"@",
"Nonnull",
"final",
"Supplier",
"<",
"T",
">",
"aSupplier",
")",
"{",
"ValueEnforcer",
".",
... | Create a mock supplier for a factory without parameters.
@param aDstClass
The destination class to be mocked. May not be <code>null</code>.
@param aSupplier
The supplier/factory without parameters to be used. May not be
<code>null</code>.
@return Never <code>null</code>.
@param <T>
The type to be mocked | [
"Create",
"a",
"mock",
"supplier",
"for",
"a",
"factory",
"without",
"parameters",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mock/CommonsMock.java#L231-L238 |
136,796 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mock/CommonsMock.java | MockSupplier.create | @Nonnull
public static <T> MockSupplier create (@Nonnull final Class <T> aDstClass,
@Nonnull final Param [] aParams,
@Nonnull final Function <IGetterDirectTrait [], T> aSupplier)
{
ValueEnforcer.notNull (aDstClass, "DstClass");
ValueEnforcer.notNull (aParams, "Params");
ValueEnforcer.notNull (aSupplier, "Supplier");
return new MockSupplier (aDstClass, aParams, aSupplier);
} | java | @Nonnull
public static <T> MockSupplier create (@Nonnull final Class <T> aDstClass,
@Nonnull final Param [] aParams,
@Nonnull final Function <IGetterDirectTrait [], T> aSupplier)
{
ValueEnforcer.notNull (aDstClass, "DstClass");
ValueEnforcer.notNull (aParams, "Params");
ValueEnforcer.notNull (aSupplier, "Supplier");
return new MockSupplier (aDstClass, aParams, aSupplier);
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"T",
">",
"MockSupplier",
"create",
"(",
"@",
"Nonnull",
"final",
"Class",
"<",
"T",
">",
"aDstClass",
",",
"@",
"Nonnull",
"final",
"Param",
"[",
"]",
"aParams",
",",
"@",
"Nonnull",
"final",
"Function",
"<",
"... | Create a mock supplier with parameters.
@param aDstClass
The destination class to be mocked. May not be <code>null</code>.
@param aParams
The parameter declarations to be used. May not be
<code>null</code>.
@param aSupplier
The generic function to be invoked. Must take an array of
{@link IGetterDirectTrait} and return an instance of the passed
class.
@return Never <code>null</code>.
@param <T>
The type to be mocked | [
"Create",
"a",
"mock",
"supplier",
"with",
"parameters",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mock/CommonsMock.java#L256-L265 |
136,797 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/text/codepoint/AbstractCodepointIterator.java | AbstractCodepointIterator._peekChars | @Nullable
private char [] _peekChars (@Nonnegative final int nPos)
{
if (nPos < 0 || nPos >= limit ())
return null;
final char c1 = get (nPos);
if (Character.isHighSurrogate (c1) && nPos < limit ())
{
final char c2 = get (nPos + 1);
if (Character.isLowSurrogate (c2))
return new char [] { c1, c2 };
throw new InvalidCharacterException (c2);
}
if (Character.isLowSurrogate (c1) && nPos > 1)
{
final char c2 = get (nPos - 1);
if (Character.isHighSurrogate (c2))
return new char [] { c2, c1 };
throw new InvalidCharacterException (c2);
}
return new char [] { c1 };
} | java | @Nullable
private char [] _peekChars (@Nonnegative final int nPos)
{
if (nPos < 0 || nPos >= limit ())
return null;
final char c1 = get (nPos);
if (Character.isHighSurrogate (c1) && nPos < limit ())
{
final char c2 = get (nPos + 1);
if (Character.isLowSurrogate (c2))
return new char [] { c1, c2 };
throw new InvalidCharacterException (c2);
}
if (Character.isLowSurrogate (c1) && nPos > 1)
{
final char c2 = get (nPos - 1);
if (Character.isHighSurrogate (c2))
return new char [] { c2, c1 };
throw new InvalidCharacterException (c2);
}
return new char [] { c1 };
} | [
"@",
"Nullable",
"private",
"char",
"[",
"]",
"_peekChars",
"(",
"@",
"Nonnegative",
"final",
"int",
"nPos",
")",
"{",
"if",
"(",
"nPos",
"<",
"0",
"||",
"nPos",
">=",
"limit",
"(",
")",
")",
"return",
"null",
";",
"final",
"char",
"c1",
"=",
"get"... | Peek the specified chars in the iterator. If the codepoint is not
supplemental, the char array will have a single member. If the codepoint is
supplemental, the char array will have two members, representing the high
and low surrogate chars | [
"Peek",
"the",
"specified",
"chars",
"in",
"the",
"iterator",
".",
"If",
"the",
"codepoint",
"is",
"not",
"supplemental",
"the",
"char",
"array",
"will",
"have",
"a",
"single",
"member",
".",
"If",
"the",
"codepoint",
"is",
"supplemental",
"the",
"char",
"... | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/text/codepoint/AbstractCodepointIterator.java#L109-L133 |
136,798 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/xpath/XPathHelper.java | XPathHelper.createNewXPathExpression | @Nonnull
public static XPathExpression createNewXPathExpression (@Nonnull final XPath aXPath,
@Nonnull @Nonempty final String sXPath)
{
ValueEnforcer.notNull (aXPath, "XPath");
ValueEnforcer.notNull (sXPath, "XPathExpression");
try
{
return aXPath.compile (sXPath);
}
catch (final XPathExpressionException ex)
{
throw new IllegalArgumentException ("Failed to compile XPath expression '" + sXPath + "'", ex);
}
} | java | @Nonnull
public static XPathExpression createNewXPathExpression (@Nonnull final XPath aXPath,
@Nonnull @Nonempty final String sXPath)
{
ValueEnforcer.notNull (aXPath, "XPath");
ValueEnforcer.notNull (sXPath, "XPathExpression");
try
{
return aXPath.compile (sXPath);
}
catch (final XPathExpressionException ex)
{
throw new IllegalArgumentException ("Failed to compile XPath expression '" + sXPath + "'", ex);
}
} | [
"@",
"Nonnull",
"public",
"static",
"XPathExpression",
"createNewXPathExpression",
"(",
"@",
"Nonnull",
"final",
"XPath",
"aXPath",
",",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sXPath",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aXPath",
",",
... | Create a new XPath expression for evaluation.
@param aXPath
The pre-created XPath object. May not be <code>null</code>.
@param sXPath
The main XPath string to be evaluated
@return The {@link XPathExpression} object to be used.
@throws IllegalArgumentException
if the XPath cannot be compiled | [
"Create",
"a",
"new",
"XPath",
"expression",
"for",
"evaluation",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/xpath/XPathHelper.java#L414-L429 |
136,799 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/write/XMLCharHelper.java | XMLCharHelper.isInvalidXMLNameStartChar | public static boolean isInvalidXMLNameStartChar (@Nonnull final EXMLSerializeVersion eXMLVersion, final int c)
{
switch (eXMLVersion)
{
case XML_10:
return INVALID_NAME_START_CHAR_XML10.get (c);
case XML_11:
return INVALID_NAME_START_CHAR_XML11.get (c);
case HTML:
return INVALID_CHAR_HTML.get (c);
default:
throw new IllegalArgumentException ("Unsupported XML version " + eXMLVersion + "!");
}
} | java | public static boolean isInvalidXMLNameStartChar (@Nonnull final EXMLSerializeVersion eXMLVersion, final int c)
{
switch (eXMLVersion)
{
case XML_10:
return INVALID_NAME_START_CHAR_XML10.get (c);
case XML_11:
return INVALID_NAME_START_CHAR_XML11.get (c);
case HTML:
return INVALID_CHAR_HTML.get (c);
default:
throw new IllegalArgumentException ("Unsupported XML version " + eXMLVersion + "!");
}
} | [
"public",
"static",
"boolean",
"isInvalidXMLNameStartChar",
"(",
"@",
"Nonnull",
"final",
"EXMLSerializeVersion",
"eXMLVersion",
",",
"final",
"int",
"c",
")",
"{",
"switch",
"(",
"eXMLVersion",
")",
"{",
"case",
"XML_10",
":",
"return",
"INVALID_NAME_START_CHAR_XML... | Check if the passed character is invalid for an element or attribute name
on the first position
@param eXMLVersion
XML version to be used. May not be <code>null</code>.
@param c
char to check
@return <code>true</code> if the char is invalid | [
"Check",
"if",
"the",
"passed",
"character",
"is",
"invalid",
"for",
"an",
"element",
"or",
"attribute",
"name",
"on",
"the",
"first",
"position"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLCharHelper.java#L643-L656 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.