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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
MTDdk/jawn | jawn-server/src/main/java/net/javapla/jawn/server/JawnServletContext.java | JawnServletContext.parseRequestMultiPartItems | public Optional<List<FormItem>> parseRequestMultiPartItems(String encoding) {
DiskFileItemFactory factory = new DiskFileItemFactory();
factory.setSizeThreshold(properties.getInt(Constants.PROPERTY_UPLOADS_MAX_SIZE/*Constants.Params.maxUploadSize.name()*/));//Configuration.getMaxUploadSize());
fa... | java | public Optional<List<FormItem>> parseRequestMultiPartItems(String encoding) {
DiskFileItemFactory factory = new DiskFileItemFactory();
factory.setSizeThreshold(properties.getInt(Constants.PROPERTY_UPLOADS_MAX_SIZE/*Constants.Params.maxUploadSize.name()*/));//Configuration.getMaxUploadSize());
fa... | [
"public",
"Optional",
"<",
"List",
"<",
"FormItem",
">",
">",
"parseRequestMultiPartItems",
"(",
"String",
"encoding",
")",
"{",
"DiskFileItemFactory",
"factory",
"=",
"new",
"DiskFileItemFactory",
"(",
")",
";",
"factory",
".",
"setSizeThreshold",
"(",
"propertie... | Gets the FileItemIterator of the input.
Can be used to process uploads in a streaming fashion. Check out:
http://commons.apache.org/fileupload/streaming.html
@return the FileItemIterator of the request or null if there was an
error. | [
"Gets",
"the",
"FileItemIterator",
"of",
"the",
"input",
"."
] | 4ec2d09b97d413efdead7487e6075e5bfd13b925 | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-server/src/main/java/net/javapla/jawn/server/JawnServletContext.java#L518-L541 | train |
buschmais/jqa-core-framework | rule/src/main/java/com/buschmais/jqassistant/core/rule/api/RuleHelper.java | RuleHelper.printRuleSet | public void printRuleSet(RuleSet ruleSet) throws RuleException {
RuleSelection ruleSelection = RuleSelection.builder()
.conceptIds(ruleSet.getConceptBucket().getIds())
.constraintIds(ruleSet.getConstraintBucket().getIds())
.groupIds(ruleSet.getGroupsBucket().getIds()).build()... | java | public void printRuleSet(RuleSet ruleSet) throws RuleException {
RuleSelection ruleSelection = RuleSelection.builder()
.conceptIds(ruleSet.getConceptBucket().getIds())
.constraintIds(ruleSet.getConstraintBucket().getIds())
.groupIds(ruleSet.getGroupsBucket().getIds()).build()... | [
"public",
"void",
"printRuleSet",
"(",
"RuleSet",
"ruleSet",
")",
"throws",
"RuleException",
"{",
"RuleSelection",
"ruleSelection",
"=",
"RuleSelection",
".",
"builder",
"(",
")",
".",
"conceptIds",
"(",
"ruleSet",
".",
"getConceptBucket",
"(",
")",
".",
"getIds... | Logs the given rule set on level info.
@param ruleSet
The rule set. | [
"Logs",
"the",
"given",
"rule",
"set",
"on",
"level",
"info",
"."
] | 0e63ff509cfe52f9063539a23d5f9f183b2ea4a5 | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/rule/src/main/java/com/buschmais/jqassistant/core/rule/api/RuleHelper.java#L36-L42 | train |
buschmais/jqa-core-framework | rule/src/main/java/com/buschmais/jqassistant/core/rule/api/RuleHelper.java | RuleHelper.printValidRules | private void printValidRules(CollectRulesVisitor visitor) {
logger.info("Groups [" + visitor.getGroups().size() + "]");
for (Group group : visitor.getGroups()) {
logger.info(LOG_LINE_PREFIX + group.getId() + "\"");
}
logger.info("Constraints [" + visitor.getConstraints().size... | java | private void printValidRules(CollectRulesVisitor visitor) {
logger.info("Groups [" + visitor.getGroups().size() + "]");
for (Group group : visitor.getGroups()) {
logger.info(LOG_LINE_PREFIX + group.getId() + "\"");
}
logger.info("Constraints [" + visitor.getConstraints().size... | [
"private",
"void",
"printValidRules",
"(",
"CollectRulesVisitor",
"visitor",
")",
"{",
"logger",
".",
"info",
"(",
"\"Groups [\"",
"+",
"visitor",
".",
"getGroups",
"(",
")",
".",
"size",
"(",
")",
"+",
"\"]\"",
")",
";",
"for",
"(",
"Group",
"group",
":... | Prints all valid rules.
@param visitor
The visitor. | [
"Prints",
"all",
"valid",
"rules",
"."
] | 0e63ff509cfe52f9063539a23d5f9f183b2ea4a5 | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/rule/src/main/java/com/buschmais/jqassistant/core/rule/api/RuleHelper.java#L62-L75 | train |
buschmais/jqa-core-framework | rule/src/main/java/com/buschmais/jqassistant/core/rule/api/RuleHelper.java | RuleHelper.getAllRules | private CollectRulesVisitor getAllRules(RuleSet ruleSet, RuleSelection ruleSelection) throws RuleException {
CollectRulesVisitor visitor = new CollectRulesVisitor();
RuleSetExecutor executor = new RuleSetExecutor(visitor, new RuleSetExecutorConfiguration());
executor.execute(ruleSet, ruleSelecti... | java | private CollectRulesVisitor getAllRules(RuleSet ruleSet, RuleSelection ruleSelection) throws RuleException {
CollectRulesVisitor visitor = new CollectRulesVisitor();
RuleSetExecutor executor = new RuleSetExecutor(visitor, new RuleSetExecutorConfiguration());
executor.execute(ruleSet, ruleSelecti... | [
"private",
"CollectRulesVisitor",
"getAllRules",
"(",
"RuleSet",
"ruleSet",
",",
"RuleSelection",
"ruleSelection",
")",
"throws",
"RuleException",
"{",
"CollectRulesVisitor",
"visitor",
"=",
"new",
"CollectRulesVisitor",
"(",
")",
";",
"RuleSetExecutor",
"executor",
"="... | Determines all rules.
@param ruleSet
The rule set.
@return The visitor with all valid and missing rules.
@throws RuleException
If the rules cannot be evaluated. | [
"Determines",
"all",
"rules",
"."
] | 0e63ff509cfe52f9063539a23d5f9f183b2ea4a5 | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/rule/src/main/java/com/buschmais/jqassistant/core/rule/api/RuleHelper.java#L86-L91 | train |
buschmais/jqa-core-framework | rule/src/main/java/com/buschmais/jqassistant/core/rule/api/RuleHelper.java | RuleHelper.printMissingRules | private boolean printMissingRules(CollectRulesVisitor visitor) {
Set<String> missingConcepts = visitor.getMissingConcepts();
if (!missingConcepts.isEmpty()) {
logger.info("Missing concepts [" + missingConcepts.size() + "]");
for (String missingConcept : missingConcepts) {
... | java | private boolean printMissingRules(CollectRulesVisitor visitor) {
Set<String> missingConcepts = visitor.getMissingConcepts();
if (!missingConcepts.isEmpty()) {
logger.info("Missing concepts [" + missingConcepts.size() + "]");
for (String missingConcept : missingConcepts) {
... | [
"private",
"boolean",
"printMissingRules",
"(",
"CollectRulesVisitor",
"visitor",
")",
"{",
"Set",
"<",
"String",
">",
"missingConcepts",
"=",
"visitor",
".",
"getMissingConcepts",
"(",
")",
";",
"if",
"(",
"!",
"missingConcepts",
".",
"isEmpty",
"(",
")",
")"... | Prints all missing rule ids.
@param visitor
The visitor. | [
"Prints",
"all",
"missing",
"rule",
"ids",
"."
] | 0e63ff509cfe52f9063539a23d5f9f183b2ea4a5 | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/rule/src/main/java/com/buschmais/jqassistant/core/rule/api/RuleHelper.java#L99-L122 | train |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/templates/ContentTemplateLoader.java | ContentTemplateLoader.getTemplateNameForResult | public String getTemplateNameForResult(Route route, Result response) {
String template = response.template();
if (template == null) {
if (route != null) {
String controllerPath = RouterHelper.getReverseRouteFast(route.getController());
... | java | public String getTemplateNameForResult(Route route, Result response) {
String template = response.template();
if (template == null) {
if (route != null) {
String controllerPath = RouterHelper.getReverseRouteFast(route.getController());
... | [
"public",
"String",
"getTemplateNameForResult",
"(",
"Route",
"route",
",",
"Result",
"response",
")",
"{",
"String",
"template",
"=",
"response",
".",
"template",
"(",
")",
";",
"if",
"(",
"template",
"==",
"null",
")",
"{",
"if",
"(",
"route",
"!=",
"n... | If the template is specified by the user with a suffix corresponding to the template engine suffix, then this is
removed before returning the template.
Suffixes such as .st or .ftl.html
@param route
@param response
@return | [
"If",
"the",
"template",
"is",
"specified",
"by",
"the",
"user",
"with",
"a",
"suffix",
"corresponding",
"to",
"the",
"template",
"engine",
"suffix",
"then",
"this",
"is",
"removed",
"before",
"returning",
"the",
"template",
".",
"Suffixes",
"such",
"as",
".... | 4ec2d09b97d413efdead7487e6075e5bfd13b925 | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/templates/ContentTemplateLoader.java#L59-L82 | train |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/templates/ContentTemplateLoader.java | ContentTemplateLoader.locateLayoutTemplate | public T locateLayoutTemplate(String controller, final String layout, final boolean useCache) throws ViewException {
// first see if we have already looked for the template
final String controllerLayoutCombined = controller + '/' + layout;
if (useCache && cachedTemplates.containsKey(controllerLa... | java | public T locateLayoutTemplate(String controller, final String layout, final boolean useCache) throws ViewException {
// first see if we have already looked for the template
final String controllerLayoutCombined = controller + '/' + layout;
if (useCache && cachedTemplates.containsKey(controllerLa... | [
"public",
"T",
"locateLayoutTemplate",
"(",
"String",
"controller",
",",
"final",
"String",
"layout",
",",
"final",
"boolean",
"useCache",
")",
"throws",
"ViewException",
"{",
"// first see if we have already looked for the template",
"final",
"String",
"controllerLayoutCom... | If found, uses the provided layout within the controller folder.
If not found, it looks for the default template within the controller folder
then use this to override the root default template | [
"If",
"found",
"uses",
"the",
"provided",
"layout",
"within",
"the",
"controller",
"folder",
".",
"If",
"not",
"found",
"it",
"looks",
"for",
"the",
"default",
"template",
"within",
"the",
"controller",
"folder",
"then",
"use",
"this",
"to",
"override",
"the... | 4ec2d09b97d413efdead7487e6075e5bfd13b925 | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/templates/ContentTemplateLoader.java#L103-L122 | train |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/Controller.java | Controller.flash | protected void flash(Map<String, String> values){
for(Object key:values.keySet() ){
flash(key.toString(), values.get(key));
}
} | java | protected void flash(Map<String, String> values){
for(Object key:values.keySet() ){
flash(key.toString(), values.get(key));
}
} | [
"protected",
"void",
"flash",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"values",
")",
"{",
"for",
"(",
"Object",
"key",
":",
"values",
".",
"keySet",
"(",
")",
")",
"{",
"flash",
"(",
"key",
".",
"toString",
"(",
")",
",",
"values",
".",
"g... | Convenience method, takes in a map of values to flash.
@see #flash(String, String)
@param values values to flash. | [
"Convenience",
"method",
"takes",
"in",
"a",
"map",
"of",
"values",
"to",
"flash",
"."
] | 4ec2d09b97d413efdead7487e6075e5bfd13b925 | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/Controller.java#L344-L348 | train |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/Controller.java | Controller.flash | protected void flash(String name, String value) {
/*if (session().get(Context.FLASH_SESSION_KEYWORD) == null) {
session().put(Context.FLASH_SESSION_KEYWORD, new HashMap<String, Object>());
}
((Map<String, Object>) session().get(Context.FLASH_SESSION_KEYWORD)).put(name, value);*/
... | java | protected void flash(String name, String value) {
/*if (session().get(Context.FLASH_SESSION_KEYWORD) == null) {
session().put(Context.FLASH_SESSION_KEYWORD, new HashMap<String, Object>());
}
((Map<String, Object>) session().get(Context.FLASH_SESSION_KEYWORD)).put(name, value);*/
... | [
"protected",
"void",
"flash",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"/*if (session().get(Context.FLASH_SESSION_KEYWORD) == null) {\n session().put(Context.FLASH_SESSION_KEYWORD, new HashMap<String, Object>());\n }\n ((Map<String, Object>) session().g... | Sends value to flash. Flash survives one more request. Using flash is typical
for POST->REDIRECT->GET pattern,
@param name name of value to flash
@param value value to live for one more request in current session. | [
"Sends",
"value",
"to",
"flash",
".",
"Flash",
"survives",
"one",
"more",
"request",
".",
"Using",
"flash",
"is",
"typical",
"for",
"POST",
"-",
">",
"REDIRECT",
"-",
">",
"GET",
"pattern"
] | 4ec2d09b97d413efdead7487e6075e5bfd13b925 | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/Controller.java#L378-L385 | train |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/Controller.java | Controller.redirectToReferrer | protected void redirectToReferrer() {
String referrer = context.requestHeader("Referer");
referrer = referrer == null? context.contextPath()/*injector.getInstance(DeploymentInfo.class).getContextPath()*/ : referrer;
redirect(referrer);
} | java | protected void redirectToReferrer() {
String referrer = context.requestHeader("Referer");
referrer = referrer == null? context.contextPath()/*injector.getInstance(DeploymentInfo.class).getContextPath()*/ : referrer;
redirect(referrer);
} | [
"protected",
"void",
"redirectToReferrer",
"(",
")",
"{",
"String",
"referrer",
"=",
"context",
".",
"requestHeader",
"(",
"\"Referer\"",
")",
";",
"referrer",
"=",
"referrer",
"==",
"null",
"?",
"context",
".",
"contextPath",
"(",
")",
"/*injector.getInstance(D... | Redirects to referrer if one exists. If a referrer does not exist, it will be redirected to
the root of the application.
@return {@link HttpSupport.HttpBuilder}, to accept additional information. | [
"Redirects",
"to",
"referrer",
"if",
"one",
"exists",
".",
"If",
"a",
"referrer",
"does",
"not",
"exist",
"it",
"will",
"be",
"redirected",
"to",
"the",
"root",
"of",
"the",
"application",
"."
] | 4ec2d09b97d413efdead7487e6075e5bfd13b925 | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/Controller.java#L438-L442 | train |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/Controller.java | Controller.cookieValue | protected String cookieValue(String name){
Cookie cookie = cookie(name);
return cookie != null ? cookie.getValue() : null;
} | java | protected String cookieValue(String name){
Cookie cookie = cookie(name);
return cookie != null ? cookie.getValue() : null;
} | [
"protected",
"String",
"cookieValue",
"(",
"String",
"name",
")",
"{",
"Cookie",
"cookie",
"=",
"cookie",
"(",
"name",
")",
";",
"return",
"cookie",
"!=",
"null",
"?",
"cookie",
".",
"getValue",
"(",
")",
":",
"null",
";",
"}"
] | Convenience method, returns cookie value.
@param name name of cookie.
@return cookie value. | [
"Convenience",
"method",
"returns",
"cookie",
"value",
"."
] | 4ec2d09b97d413efdead7487e6075e5bfd13b925 | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/Controller.java#L1253-L1256 | train |
buschmais/jqa-core-framework | shared/src/main/java/com/buschmais/jqassistant/core/shared/reflection/ClassHelper.java | ClassHelper.getType | public <T> Class<T> getType(String typeName) {
try {
return (Class<T>) classLoader.loadClass(typeName);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Cannot find class " + typeName, e);
}
} | java | public <T> Class<T> getType(String typeName) {
try {
return (Class<T>) classLoader.loadClass(typeName);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Cannot find class " + typeName, e);
}
} | [
"public",
"<",
"T",
">",
"Class",
"<",
"T",
">",
"getType",
"(",
"String",
"typeName",
")",
"{",
"try",
"{",
"return",
"(",
"Class",
"<",
"T",
">",
")",
"classLoader",
".",
"loadClass",
"(",
"typeName",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundExce... | Create and return an instance of the given type name.
@param typeName The type name.
@param <T> The type.
@return The instance. | [
"Create",
"and",
"return",
"an",
"instance",
"of",
"the",
"given",
"type",
"name",
"."
] | 0e63ff509cfe52f9063539a23d5f9f183b2ea4a5 | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/shared/src/main/java/com/buschmais/jqassistant/core/shared/reflection/ClassHelper.java#L26-L32 | train |
buschmais/jqa-core-framework | report/src/main/java/com/buschmais/jqassistant/core/report/impl/CompositeReportPlugin.java | CompositeReportPlugin.selectReportPlugins | private Map<String, ReportPlugin> selectReportPlugins(ExecutableRule rule) throws ReportException {
Set<String> selection = rule.getReport().getSelectedTypes();
Map<String, ReportPlugin> reportPlugins = new HashMap<>();
if (selection != null) {
for (String type : selection) {
... | java | private Map<String, ReportPlugin> selectReportPlugins(ExecutableRule rule) throws ReportException {
Set<String> selection = rule.getReport().getSelectedTypes();
Map<String, ReportPlugin> reportPlugins = new HashMap<>();
if (selection != null) {
for (String type : selection) {
... | [
"private",
"Map",
"<",
"String",
",",
"ReportPlugin",
">",
"selectReportPlugins",
"(",
"ExecutableRule",
"rule",
")",
"throws",
"ReportException",
"{",
"Set",
"<",
"String",
">",
"selection",
"=",
"rule",
".",
"getReport",
"(",
")",
".",
"getSelectedTypes",
"(... | Select the report writers for the given rule.
@param rule
The rule.
@throws ReportException
If no writer exists for a specified id. | [
"Select",
"the",
"report",
"writers",
"for",
"the",
"given",
"rule",
"."
] | 0e63ff509cfe52f9063539a23d5f9f183b2ea4a5 | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/report/src/main/java/com/buschmais/jqassistant/core/report/impl/CompositeReportPlugin.java#L202-L215 | train |
jinahya/database-metadata-bind | src/main/java/com/github/jinahya/database/metadata/bind/Utils.java | Utils.labels | static Set<String> labels(final ResultSet results) throws SQLException {
final ResultSetMetaData metadata = results.getMetaData();
final int count = metadata.getColumnCount();
final Set<String> labels = new HashSet<>(count);
for (int i = 1; i <= count; i++) {
labels.add(metad... | java | static Set<String> labels(final ResultSet results) throws SQLException {
final ResultSetMetaData metadata = results.getMetaData();
final int count = metadata.getColumnCount();
final Set<String> labels = new HashSet<>(count);
for (int i = 1; i <= count; i++) {
labels.add(metad... | [
"static",
"Set",
"<",
"String",
">",
"labels",
"(",
"final",
"ResultSet",
"results",
")",
"throws",
"SQLException",
"{",
"final",
"ResultSetMetaData",
"metadata",
"=",
"results",
".",
"getMetaData",
"(",
")",
";",
"final",
"int",
"count",
"=",
"metadata",
".... | Returns a set of column labels of given result set.
@param results the result set from which column labels are read.
@return a set of column labels
@throws SQLException if a database error occurs.
@see ResultSet#getMetaData() | [
"Returns",
"a",
"set",
"of",
"column",
"labels",
"of",
"given",
"result",
"set",
"."
] | 94fc9f9c85149c30dcfd10434f475d8332eedf76 | https://github.com/jinahya/database-metadata-bind/blob/94fc9f9c85149c30dcfd10434f475d8332eedf76/src/main/java/com/github/jinahya/database/metadata/bind/Utils.java#L110-L118 | train |
buschmais/jqa-core-framework | report/src/main/java/com/buschmais/jqassistant/core/report/impl/XmlReportPlugin.java | XmlReportPlugin.writeStatus | private void writeStatus(Result.Status status) throws XMLStreamException {
xmlStreamWriter.writeStartElement("status");
xmlStreamWriter.writeCharacters(status.name().toLowerCase());
xmlStreamWriter.writeEndElement();
} | java | private void writeStatus(Result.Status status) throws XMLStreamException {
xmlStreamWriter.writeStartElement("status");
xmlStreamWriter.writeCharacters(status.name().toLowerCase());
xmlStreamWriter.writeEndElement();
} | [
"private",
"void",
"writeStatus",
"(",
"Result",
".",
"Status",
"status",
")",
"throws",
"XMLStreamException",
"{",
"xmlStreamWriter",
".",
"writeStartElement",
"(",
"\"status\"",
")",
";",
"xmlStreamWriter",
".",
"writeCharacters",
"(",
"status",
".",
"name",
"("... | Write the status of the current result.
@throws XMLStreamException
If a problem occurs. | [
"Write",
"the",
"status",
"of",
"the",
"current",
"result",
"."
] | 0e63ff509cfe52f9063539a23d5f9f183b2ea4a5 | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/report/src/main/java/com/buschmais/jqassistant/core/report/impl/XmlReportPlugin.java#L226-L230 | train |
buschmais/jqa-core-framework | report/src/main/java/com/buschmais/jqassistant/core/report/impl/XmlReportPlugin.java | XmlReportPlugin.writeColumn | private void writeColumn(String columnName, Object value) throws XMLStreamException {
xmlStreamWriter.writeStartElement("column");
xmlStreamWriter.writeAttribute("name", columnName);
String stringValue = null;
if (value instanceof CompositeObject) {
CompositeObject descriptor... | java | private void writeColumn(String columnName, Object value) throws XMLStreamException {
xmlStreamWriter.writeStartElement("column");
xmlStreamWriter.writeAttribute("name", columnName);
String stringValue = null;
if (value instanceof CompositeObject) {
CompositeObject descriptor... | [
"private",
"void",
"writeColumn",
"(",
"String",
"columnName",
",",
"Object",
"value",
")",
"throws",
"XMLStreamException",
"{",
"xmlStreamWriter",
".",
"writeStartElement",
"(",
"\"column\"",
")",
";",
"xmlStreamWriter",
".",
"writeAttribute",
"(",
"\"name\"",
",",... | Determines the language and language element of a descriptor from a result
column.
@param columnName
The name of the column.
@param value
The value.
@throws XMLStreamException
If a problem occurs. | [
"Determines",
"the",
"language",
"and",
"language",
"element",
"of",
"a",
"descriptor",
"from",
"a",
"result",
"column",
"."
] | 0e63ff509cfe52f9063539a23d5f9f183b2ea4a5 | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/report/src/main/java/com/buschmais/jqassistant/core/report/impl/XmlReportPlugin.java#L243-L275 | train |
buschmais/jqa-core-framework | report/src/main/java/com/buschmais/jqassistant/core/report/impl/XmlReportPlugin.java | XmlReportPlugin.writeDuration | private void writeDuration(long beginTime) throws XMLStreamException {
xmlStreamWriter.writeStartElement("duration");
xmlStreamWriter.writeCharacters(Long.toString(System.currentTimeMillis() - beginTime));
xmlStreamWriter.writeEndElement(); // duration
} | java | private void writeDuration(long beginTime) throws XMLStreamException {
xmlStreamWriter.writeStartElement("duration");
xmlStreamWriter.writeCharacters(Long.toString(System.currentTimeMillis() - beginTime));
xmlStreamWriter.writeEndElement(); // duration
} | [
"private",
"void",
"writeDuration",
"(",
"long",
"beginTime",
")",
"throws",
"XMLStreamException",
"{",
"xmlStreamWriter",
".",
"writeStartElement",
"(",
"\"duration\"",
")",
";",
"xmlStreamWriter",
".",
"writeCharacters",
"(",
"Long",
".",
"toString",
"(",
"System"... | Writes the duration.
@param beginTime
The begin time.
@throws XMLStreamException
If writing fails. | [
"Writes",
"the",
"duration",
"."
] | 0e63ff509cfe52f9063539a23d5f9f183b2ea4a5 | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/report/src/main/java/com/buschmais/jqassistant/core/report/impl/XmlReportPlugin.java#L285-L289 | train |
buschmais/jqa-core-framework | report/src/main/java/com/buschmais/jqassistant/core/report/impl/XmlReportPlugin.java | XmlReportPlugin.writeSeverity | private void writeSeverity(Severity severity) throws XMLStreamException {
xmlStreamWriter.writeStartElement("severity");
xmlStreamWriter.writeAttribute("level", severity.getLevel().toString());
xmlStreamWriter.writeCharacters(severity.getValue());
xmlStreamWriter.writeEndElement();
} | java | private void writeSeverity(Severity severity) throws XMLStreamException {
xmlStreamWriter.writeStartElement("severity");
xmlStreamWriter.writeAttribute("level", severity.getLevel().toString());
xmlStreamWriter.writeCharacters(severity.getValue());
xmlStreamWriter.writeEndElement();
} | [
"private",
"void",
"writeSeverity",
"(",
"Severity",
"severity",
")",
"throws",
"XMLStreamException",
"{",
"xmlStreamWriter",
".",
"writeStartElement",
"(",
"\"severity\"",
")",
";",
"xmlStreamWriter",
".",
"writeAttribute",
"(",
"\"level\"",
",",
"severity",
".",
"... | Writes the severity of the rule.
@param severity
The severity the rule has been executed with
@throws XMLStreamException
If writing fails. | [
"Writes",
"the",
"severity",
"of",
"the",
"rule",
"."
] | 0e63ff509cfe52f9063539a23d5f9f183b2ea4a5 | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/report/src/main/java/com/buschmais/jqassistant/core/report/impl/XmlReportPlugin.java#L299-L304 | train |
buschmais/jqa-core-framework | report/src/main/java/com/buschmais/jqassistant/core/report/impl/XmlReportPlugin.java | XmlReportPlugin.run | private void run(XmlOperation operation) throws ReportException {
try {
operation.run();
} catch (XMLStreamException | IOException e) {
throw new ReportException("Cannot write to XML report.", e);
}
} | java | private void run(XmlOperation operation) throws ReportException {
try {
operation.run();
} catch (XMLStreamException | IOException e) {
throw new ReportException("Cannot write to XML report.", e);
}
} | [
"private",
"void",
"run",
"(",
"XmlOperation",
"operation",
")",
"throws",
"ReportException",
"{",
"try",
"{",
"operation",
".",
"run",
"(",
")",
";",
"}",
"catch",
"(",
"XMLStreamException",
"|",
"IOException",
"e",
")",
"{",
"throw",
"new",
"ReportExceptio... | Defines an operation to write XML elements.
@param operation
The operation.
@throws ReportException
If writing fails. | [
"Defines",
"an",
"operation",
"to",
"write",
"XML",
"elements",
"."
] | 0e63ff509cfe52f9063539a23d5f9f183b2ea4a5 | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/report/src/main/java/com/buschmais/jqassistant/core/report/impl/XmlReportPlugin.java#L314-L320 | train |
MTDdk/jawn | jawn-templates-stringtemplate/src/main/java/net/javapla/jawn/templates/stringtemplate/rewrite/STFastGroupDir.java | STFastGroupDir.loadTemplateResource | private final CompiledST loadTemplateResource(String prefix, String unqualifiedFileName) {
//if (resourceRoot == null) return null;
//return loadTemplate(resourceRoot, prefix, unqualifiedFileName);
if (resourceRoots.isEmpty()) return null;
CompiledST template = null;
for (URL res... | java | private final CompiledST loadTemplateResource(String prefix, String unqualifiedFileName) {
//if (resourceRoot == null) return null;
//return loadTemplate(resourceRoot, prefix, unqualifiedFileName);
if (resourceRoots.isEmpty()) return null;
CompiledST template = null;
for (URL res... | [
"private",
"final",
"CompiledST",
"loadTemplateResource",
"(",
"String",
"prefix",
",",
"String",
"unqualifiedFileName",
")",
"{",
"//if (resourceRoot == null) return null;",
"//return loadTemplate(resourceRoot, prefix, unqualifiedFileName);",
"if",
"(",
"resourceRoots",
".",
"is... | Loads from a jar or similar resource if the template could not be found
directly on the filesystem. | [
"Loads",
"from",
"a",
"jar",
"or",
"similar",
"resource",
"if",
"the",
"template",
"could",
"not",
"be",
"found",
"directly",
"on",
"the",
"filesystem",
"."
] | 4ec2d09b97d413efdead7487e6075e5bfd13b925 | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-templates-stringtemplate/src/main/java/net/javapla/jawn/templates/stringtemplate/rewrite/STFastGroupDir.java#L123-L133 | train |
MTDdk/jawn | jawn-templates-stringtemplate/src/main/java/net/javapla/jawn/templates/stringtemplate/StringTemplateTemplateEngine.java | StringTemplateTemplateEngine.renderContentTemplate | private final void renderContentTemplate(final ST contentTemplate, final Writer writer, final Map<String, Object> values/*, final String language*/, final ErrorBuffer error) {
injectTemplateValues(contentTemplate, values);
// if (language == null)
contentTemplate.write(createSTWriter(writer),... | java | private final void renderContentTemplate(final ST contentTemplate, final Writer writer, final Map<String, Object> values/*, final String language*/, final ErrorBuffer error) {
injectTemplateValues(contentTemplate, values);
// if (language == null)
contentTemplate.write(createSTWriter(writer),... | [
"private",
"final",
"void",
"renderContentTemplate",
"(",
"final",
"ST",
"contentTemplate",
",",
"final",
"Writer",
"writer",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"values",
"/*, final String language*/",
",",
"final",
"ErrorBuffer",
"error",
")"... | Renders template directly to writer | [
"Renders",
"template",
"directly",
"to",
"writer"
] | 4ec2d09b97d413efdead7487e6075e5bfd13b925 | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-templates-stringtemplate/src/main/java/net/javapla/jawn/templates/stringtemplate/StringTemplateTemplateEngine.java#L203-L209 | train |
MTDdk/jawn | jawn-templates-stringtemplate/src/main/java/net/javapla/jawn/templates/stringtemplate/StringTemplateTemplateEngine.java | StringTemplateTemplateEngine.renderContentTemplate | private final String renderContentTemplate(final ST contentTemplate, final Map<String, Object> values, final ErrorBuffer error, boolean inErrorState) {
if (contentTemplate != null) { // it has to be possible to use a layout without defining a template
try (Writer sw = new StringBuilderWriter()) {
... | java | private final String renderContentTemplate(final ST contentTemplate, final Map<String, Object> values, final ErrorBuffer error, boolean inErrorState) {
if (contentTemplate != null) { // it has to be possible to use a layout without defining a template
try (Writer sw = new StringBuilderWriter()) {
... | [
"private",
"final",
"String",
"renderContentTemplate",
"(",
"final",
"ST",
"contentTemplate",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"values",
",",
"final",
"ErrorBuffer",
"error",
",",
"boolean",
"inErrorState",
")",
"{",
"if",
"(",
"contentT... | Renders template into string
@return The rendered template if exists, or empty string | [
"Renders",
"template",
"into",
"string"
] | 4ec2d09b97d413efdead7487e6075e5bfd13b925 | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-templates-stringtemplate/src/main/java/net/javapla/jawn/templates/stringtemplate/StringTemplateTemplateEngine.java#L213-L238 | train |
MTDdk/jawn | jawn-core-new/src/main/java/net/javapla/jawn/core/util/ConvertUtil.java | ConvertUtil.toInteger | public static Integer toInteger(Object value) throws ConversionException {
if (value == null) {
return null;
} else if (value instanceof Number) {
return ((Number)value).intValue();
} else {
NumberFormat nf = new DecimalFormat();
try {
... | java | public static Integer toInteger(Object value) throws ConversionException {
if (value == null) {
return null;
} else if (value instanceof Number) {
return ((Number)value).intValue();
} else {
NumberFormat nf = new DecimalFormat();
try {
... | [
"public",
"static",
"Integer",
"toInteger",
"(",
"Object",
"value",
")",
"throws",
"ConversionException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"Number",
")",
"{",
"return",
... | Converts value to Integer if it can. If value is an Integer, it is returned, if it is a Number, it is
promoted to Integer and then returned, in all other cases, it converts the value to String,
then tries to parse Integer from it.
@param value value to be converted to Integer.
@return value converted to Integer.
@thro... | [
"Converts",
"value",
"to",
"Integer",
"if",
"it",
"can",
".",
"If",
"value",
"is",
"an",
"Integer",
"it",
"is",
"returned",
"if",
"it",
"is",
"a",
"Number",
"it",
"is",
"promoted",
"to",
"Integer",
"and",
"then",
"returned",
"in",
"all",
"other",
"case... | 4ec2d09b97d413efdead7487e6075e5bfd13b925 | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core-new/src/main/java/net/javapla/jawn/core/util/ConvertUtil.java#L31-L44 | train |
MTDdk/jawn | jawn-core-new/src/main/java/net/javapla/jawn/core/util/ConvertUtil.java | ConvertUtil.toBoolean | public static Boolean toBoolean(Object value){
if (value == null) {
return false;
} else if (value instanceof Boolean) {
return (Boolean) value;
} else if (value instanceof BigDecimal) {
return value.equals(BigDecimal.ONE);
} else if (value instanceof ... | java | public static Boolean toBoolean(Object value){
if (value == null) {
return false;
} else if (value instanceof Boolean) {
return (Boolean) value;
} else if (value instanceof BigDecimal) {
return value.equals(BigDecimal.ONE);
} else if (value instanceof ... | [
"public",
"static",
"Boolean",
"toBoolean",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"Boolean",
")",
"{",
"return",
"(",
"Boolean",
")",
"value"... | Returns true if the value is any numeric type and has a value of 1, or
if string type has a value of 'y', 't', 'true' or 'yes'. Otherwise, return false.
@param value value to convert
@return true if the value is any numeric type and has a value of 1, or
if string type has a value of 'y', 't', 'true' or 'yes'. Otherwis... | [
"Returns",
"true",
"if",
"the",
"value",
"is",
"any",
"numeric",
"type",
"and",
"has",
"a",
"value",
"of",
"1",
"or",
"if",
"string",
"type",
"has",
"a",
"value",
"of",
"y",
"t",
"true",
"or",
"yes",
".",
"Otherwise",
"return",
"false",
"."
] | 4ec2d09b97d413efdead7487e6075e5bfd13b925 | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core-new/src/main/java/net/javapla/jawn/core/util/ConvertUtil.java#L69-L89 | train |
MTDdk/jawn | jawn-core-new/src/main/java/net/javapla/jawn/core/util/ConvertUtil.java | ConvertUtil.toLong | public static Long toLong(Object value) throws ConversionException {
if (value == null) {
return null;
} else if (value instanceof Number) {
return ((Number)value).longValue();
} else {
NumberFormat nf = new DecimalFormat();
try {
... | java | public static Long toLong(Object value) throws ConversionException {
if (value == null) {
return null;
} else if (value instanceof Number) {
return ((Number)value).longValue();
} else {
NumberFormat nf = new DecimalFormat();
try {
... | [
"public",
"static",
"Long",
"toLong",
"(",
"Object",
"value",
")",
"throws",
"ConversionException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"Number",
")",
"{",
"return",
"(",
... | Converts value to Long if c it can. If value is a Long, it is returned, if it is a Number, it is
promoted to Long and then returned, in all other cases, it converts the value to String,
then tries to parse Long from it.
@param value value to be converted to Long.
@return value converted to Long.
@throws ConversionExce... | [
"Converts",
"value",
"to",
"Long",
"if",
"c",
"it",
"can",
".",
"If",
"value",
"is",
"a",
"Long",
"it",
"is",
"returned",
"if",
"it",
"is",
"a",
"Number",
"it",
"is",
"promoted",
"to",
"Long",
"and",
"then",
"returned",
"in",
"all",
"other",
"cases",... | 4ec2d09b97d413efdead7487e6075e5bfd13b925 | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core-new/src/main/java/net/javapla/jawn/core/util/ConvertUtil.java#L122-L135 | train |
buschmais/jqa-core-framework | plugin/src/main/java/com/buschmais/jqassistant/core/plugin/impl/AbstractPluginRepository.java | AbstractPluginRepository.getType | protected <T> Class<T> getType(String typeName) throws PluginRepositoryException {
try {
return (Class<T>) classLoader.loadClass(typeName.trim());
} catch (ClassNotFoundException | LinkageError e) {
// Catching class loader related errors for logging a message which plugin class
... | java | protected <T> Class<T> getType(String typeName) throws PluginRepositoryException {
try {
return (Class<T>) classLoader.loadClass(typeName.trim());
} catch (ClassNotFoundException | LinkageError e) {
// Catching class loader related errors for logging a message which plugin class
... | [
"protected",
"<",
"T",
">",
"Class",
"<",
"T",
">",
"getType",
"(",
"String",
"typeName",
")",
"throws",
"PluginRepositoryException",
"{",
"try",
"{",
"return",
"(",
"Class",
"<",
"T",
">",
")",
"classLoader",
".",
"loadClass",
"(",
"typeName",
".",
"tri... | Get the class for the given type name.
@param typeName
The type name.
@param <T>
The type name.
@return The class.
@throws PluginRepositoryException
If the type could not be loaded. | [
"Get",
"the",
"class",
"for",
"the",
"given",
"type",
"name",
"."
] | 0e63ff509cfe52f9063539a23d5f9f183b2ea4a5 | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/plugin/src/main/java/com/buschmais/jqassistant/core/plugin/impl/AbstractPluginRepository.java#L51-L59 | train |
buschmais/jqa-core-framework | plugin/src/main/java/com/buschmais/jqassistant/core/plugin/impl/AbstractPluginRepository.java | AbstractPluginRepository.createInstance | protected <T> T createInstance(String typeName) throws PluginRepositoryException {
Class<T> type = getType(typeName.trim());
try {
return type.newInstance();
} catch (InstantiationException e) {
throw new PluginRepositoryException("Cannot create instance of class " + type... | java | protected <T> T createInstance(String typeName) throws PluginRepositoryException {
Class<T> type = getType(typeName.trim());
try {
return type.newInstance();
} catch (InstantiationException e) {
throw new PluginRepositoryException("Cannot create instance of class " + type... | [
"protected",
"<",
"T",
">",
"T",
"createInstance",
"(",
"String",
"typeName",
")",
"throws",
"PluginRepositoryException",
"{",
"Class",
"<",
"T",
">",
"type",
"=",
"getType",
"(",
"typeName",
".",
"trim",
"(",
")",
")",
";",
"try",
"{",
"return",
"type",... | Create an instance of the given scanner plugin class.
@param typeName
The type name.
@param <T>
The type.
@return The plugin instance.
@throws PluginRepositoryException
If the requested instance could not be created. | [
"Create",
"an",
"instance",
"of",
"the",
"given",
"scanner",
"plugin",
"class",
"."
] | 0e63ff509cfe52f9063539a23d5f9f183b2ea4a5 | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/plugin/src/main/java/com/buschmais/jqassistant/core/plugin/impl/AbstractPluginRepository.java#L72-L83 | train |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/routes/RouterImpl.java | RouterImpl.calculateRoute | private final Route calculateRoute(HttpMethod httpMethod, String requestUri/*, ActionInvoker invoker*//*,Injector injector*/) throws RouteException {
if (routes == null) throw new IllegalStateException("Routes have not been compiled. Call #compileRoutes() first");
final Route route = matchCusto... | java | private final Route calculateRoute(HttpMethod httpMethod, String requestUri/*, ActionInvoker invoker*//*,Injector injector*/) throws RouteException {
if (routes == null) throw new IllegalStateException("Routes have not been compiled. Call #compileRoutes() first");
final Route route = matchCusto... | [
"private",
"final",
"Route",
"calculateRoute",
"(",
"HttpMethod",
"httpMethod",
",",
"String",
"requestUri",
"/*, ActionInvoker invoker*/",
"/*,Injector injector*/",
")",
"throws",
"RouteException",
"{",
"if",
"(",
"routes",
"==",
"null",
")",
"throw",
"new",
"Illegal... | It is not consistent that this particular injector handles implementations from both core and server | [
"It",
"is",
"not",
"consistent",
"that",
"this",
"particular",
"injector",
"handles",
"implementations",
"from",
"both",
"core",
"and",
"server"
] | 4ec2d09b97d413efdead7487e6075e5bfd13b925 | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/routes/RouterImpl.java#L82-L98 | train |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/routes/RouterImpl.java | RouterImpl.matchStandard | private Route matchStandard(HttpMethod httpMethod, String requestUri, ActionInvoker invoker) throws ClassLoadException {
// find potential routes
for (InternalRoute internalRoute : internalRoutes) {
if (internalRoute.matches(requestUri) ) {
Route deferred = deduceRoute(intern... | java | private Route matchStandard(HttpMethod httpMethod, String requestUri, ActionInvoker invoker) throws ClassLoadException {
// find potential routes
for (InternalRoute internalRoute : internalRoutes) {
if (internalRoute.matches(requestUri) ) {
Route deferred = deduceRoute(intern... | [
"private",
"Route",
"matchStandard",
"(",
"HttpMethod",
"httpMethod",
",",
"String",
"requestUri",
",",
"ActionInvoker",
"invoker",
")",
"throws",
"ClassLoadException",
"{",
"// find potential routes",
"for",
"(",
"InternalRoute",
"internalRoute",
":",
"internalRoutes",
... | Only to be used in DEV mode
@param httpMethod
@param requestUri
@param injector
@return
@throws ClassLoadException | [
"Only",
"to",
"be",
"used",
"in",
"DEV",
"mode"
] | 4ec2d09b97d413efdead7487e6075e5bfd13b925 | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/routes/RouterImpl.java#L196-L205 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/model/JBBPAbstractArrayField.java | JBBPAbstractArrayField.iterator | @SuppressWarnings("NullableProblems")
@Override
public Iterator<T> iterator() {
return new Iterator<T>() {
private int index = 0;
@Override
public boolean hasNext() {
return this.index < size();
}
@Override
public T next() {
if (this.index >= size()) {
... | java | @SuppressWarnings("NullableProblems")
@Override
public Iterator<T> iterator() {
return new Iterator<T>() {
private int index = 0;
@Override
public boolean hasNext() {
return this.index < size();
}
@Override
public T next() {
if (this.index >= size()) {
... | [
"@",
"SuppressWarnings",
"(",
"\"NullableProblems\"",
")",
"@",
"Override",
"public",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
")",
"{",
"return",
"new",
"Iterator",
"<",
"T",
">",
"(",
")",
"{",
"private",
"int",
"index",
"=",
"0",
";",
"@",
"Overr... | Generates an iterator to allow the array processing in loops.
@return an iterator for the array | [
"Generates",
"an",
"iterator",
"to",
"allow",
"the",
"array",
"processing",
"in",
"loops",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/model/JBBPAbstractArrayField.java#L70-L95 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPParser.java | JBBPParser.assertArrayLength | private static void assertArrayLength(final int length, final JBBPNamedFieldInfo name) {
if (length < 0) {
throw new JBBPParsingException("Detected negative calculated array length for field '" + (name == null ? "<NO NAME>" : name.getFieldPath()) + "\' [" + JBBPUtils.int2msg(length) + ']');
}
} | java | private static void assertArrayLength(final int length, final JBBPNamedFieldInfo name) {
if (length < 0) {
throw new JBBPParsingException("Detected negative calculated array length for field '" + (name == null ? "<NO NAME>" : name.getFieldPath()) + "\' [" + JBBPUtils.int2msg(length) + ']');
}
} | [
"private",
"static",
"void",
"assertArrayLength",
"(",
"final",
"int",
"length",
",",
"final",
"JBBPNamedFieldInfo",
"name",
")",
"{",
"if",
"(",
"length",
"<",
"0",
")",
"{",
"throw",
"new",
"JBBPParsingException",
"(",
"\"Detected negative calculated array length ... | Ensure that an array length is not a negative one.
@param length the array length to be checked
@param name the name information of a field, it can be null | [
"Ensure",
"that",
"an",
"array",
"length",
"is",
"not",
"a",
"negative",
"one",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPParser.java#L146-L150 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPParser.java | JBBPParser.prepare | public static JBBPParser prepare(final String script, final JBBPBitOrder bitOrder) {
return new JBBPParser(script, bitOrder, null, 0);
} | java | public static JBBPParser prepare(final String script, final JBBPBitOrder bitOrder) {
return new JBBPParser(script, bitOrder, null, 0);
} | [
"public",
"static",
"JBBPParser",
"prepare",
"(",
"final",
"String",
"script",
",",
"final",
"JBBPBitOrder",
"bitOrder",
")",
"{",
"return",
"new",
"JBBPParser",
"(",
"script",
",",
"bitOrder",
",",
"null",
",",
"0",
")",
";",
"}"
] | Prepare a parser for a script and a bit order.
@param script a text script contains field order and types reference, it must not be null
@param bitOrder the bit order for reading operations, it must not be null
@return the prepared parser for the script
@see JBBPBitOrder#LSB0
@see JBBPBitOrder#MSB0 | [
"Prepare",
"a",
"parser",
"for",
"a",
"script",
"and",
"a",
"bit",
"order",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPParser.java#L161-L163 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPParser.java | JBBPParser.prepare | public static JBBPParser prepare(final String script, final JBBPBitOrder bitOrder, final JBBPCustomFieldTypeProcessor customFieldTypeProcessor, final int flags) {
return new JBBPParser(script, bitOrder, customFieldTypeProcessor, flags);
} | java | public static JBBPParser prepare(final String script, final JBBPBitOrder bitOrder, final JBBPCustomFieldTypeProcessor customFieldTypeProcessor, final int flags) {
return new JBBPParser(script, bitOrder, customFieldTypeProcessor, flags);
} | [
"public",
"static",
"JBBPParser",
"prepare",
"(",
"final",
"String",
"script",
",",
"final",
"JBBPBitOrder",
"bitOrder",
",",
"final",
"JBBPCustomFieldTypeProcessor",
"customFieldTypeProcessor",
",",
"final",
"int",
"flags",
")",
"{",
"return",
"new",
"JBBPParser",
... | Prepare a parser for a script with defined bit order and special flags.
@param script a text script contains field order and types reference, it
must not be null
@param bitOrder the bit order for reading operations, it must not be null
@param customFieldTypeProcessor custom field type... | [
"Prepare",
"a",
"parser",
"for",
"a",
"script",
"with",
"defined",
"bit",
"order",
"and",
"special",
"flags",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPParser.java#L196-L198 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPParser.java | JBBPParser.parse | public JBBPFieldStruct parse(final InputStream in, final JBBPVarFieldProcessor varFieldProcessor, final JBBPExternalValueProvider externalValueProvider) throws IOException {
final JBBPBitInputStream bitInStream = in instanceof JBBPBitInputStream ? (JBBPBitInputStream) in : new JBBPBitInputStream(in, bitOrder);
... | java | public JBBPFieldStruct parse(final InputStream in, final JBBPVarFieldProcessor varFieldProcessor, final JBBPExternalValueProvider externalValueProvider) throws IOException {
final JBBPBitInputStream bitInStream = in instanceof JBBPBitInputStream ? (JBBPBitInputStream) in : new JBBPBitInputStream(in, bitOrder);
... | [
"public",
"JBBPFieldStruct",
"parse",
"(",
"final",
"InputStream",
"in",
",",
"final",
"JBBPVarFieldProcessor",
"varFieldProcessor",
",",
"final",
"JBBPExternalValueProvider",
"externalValueProvider",
")",
"throws",
"IOException",
"{",
"final",
"JBBPBitInputStream",
"bitInS... | Parse am input stream with defined external value provider.
@param in an input stream which content will be parsed, it must not be null
@param varFieldProcessor a var field processor, it may be null if there is
not any var field in a script, otherwise NPE will be thrown during parsing
@param ext... | [
"Parse",
"am",
"input",
"stream",
"with",
"defined",
"external",
"value",
"provider",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPParser.java#L626-L645 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPParser.java | JBBPParser.convertToSrc | public List<ResultSrcItem> convertToSrc(final TargetSources target, final String name) {
JBBPUtils.assertNotNull(name, "Name must not be null");
if (target == TargetSources.JAVA_1_6) {
final Properties metadata = new Properties();
metadata.setProperty("script", this.compiledBlock.getSource());
... | java | public List<ResultSrcItem> convertToSrc(final TargetSources target, final String name) {
JBBPUtils.assertNotNull(name, "Name must not be null");
if (target == TargetSources.JAVA_1_6) {
final Properties metadata = new Properties();
metadata.setProperty("script", this.compiledBlock.getSource());
... | [
"public",
"List",
"<",
"ResultSrcItem",
">",
"convertToSrc",
"(",
"final",
"TargetSources",
"target",
",",
"final",
"String",
"name",
")",
"{",
"JBBPUtils",
".",
"assertNotNull",
"(",
"name",
",",
"\"Name must not be null\"",
")",
";",
"if",
"(",
"target",
"==... | Convert the prepared parser into sources. It doesn't provide way to define different flag for conversion, it uses default flags for converters and provided for short fast way.
@param target target to generate sources, must not be null
@param name name of result, depends on target, must not be null, for instance clas... | [
"Convert",
"the",
"prepared",
"parser",
"into",
"sources",
".",
"It",
"doesn",
"t",
"provide",
"way",
"to",
"define",
"different",
"flag",
"for",
"conversion",
"it",
"uses",
"default",
"flags",
"for",
"converters",
"and",
"provided",
"for",
"short",
"fast",
... | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPParser.java#L720-L757 | train |
raydac/java-binary-block-parser | jbbp-plugins/jbbp-plugin-common/src/main/java/com/igormaznitsa/jbbp/plugin/common/utils/CommonUtils.java | CommonUtils.ensureEncodingName | @Nonnull
public static String ensureEncodingName(@Nullable final String charsetName) {
final Charset defaultCharset = Charset.defaultCharset();
try {
return (charsetName == null) ? defaultCharset.name() : Charset.forName(charsetName.trim()).name();
} catch (IllegalCharsetNameException ex) {
th... | java | @Nonnull
public static String ensureEncodingName(@Nullable final String charsetName) {
final Charset defaultCharset = Charset.defaultCharset();
try {
return (charsetName == null) ? defaultCharset.name() : Charset.forName(charsetName.trim()).name();
} catch (IllegalCharsetNameException ex) {
th... | [
"@",
"Nonnull",
"public",
"static",
"String",
"ensureEncodingName",
"(",
"@",
"Nullable",
"final",
"String",
"charsetName",
")",
"{",
"final",
"Charset",
"defaultCharset",
"=",
"Charset",
".",
"defaultCharset",
"(",
")",
";",
"try",
"{",
"return",
"(",
"charse... | Get charset name. If name is null then default charset name provided.
@param charsetName name of charset, can be null
@return charset name, must not be null
@throws IllegalArgumentException if charset name can't be recognized | [
"Get",
"charset",
"name",
".",
"If",
"name",
"is",
"null",
"then",
"default",
"charset",
"name",
"provided",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp-plugins/jbbp-plugin-common/src/main/java/com/igormaznitsa/jbbp/plugin/common/utils/CommonUtils.java#L43-L51 | train |
raydac/java-binary-block-parser | jbbp-plugins/jbbp-plugin-common/src/main/java/com/igormaznitsa/jbbp/plugin/common/utils/CommonUtils.java | CommonUtils.extractClassName | @Nonnull
public static String extractClassName(@Nonnull final String canonicalJavaClassName) {
final int lastDot = canonicalJavaClassName.lastIndexOf('.');
if (lastDot < 0) {
return canonicalJavaClassName.trim();
}
return canonicalJavaClassName.substring(lastDot + 1).trim();
} | java | @Nonnull
public static String extractClassName(@Nonnull final String canonicalJavaClassName) {
final int lastDot = canonicalJavaClassName.lastIndexOf('.');
if (lastDot < 0) {
return canonicalJavaClassName.trim();
}
return canonicalJavaClassName.substring(lastDot + 1).trim();
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"extractClassName",
"(",
"@",
"Nonnull",
"final",
"String",
"canonicalJavaClassName",
")",
"{",
"final",
"int",
"lastDot",
"=",
"canonicalJavaClassName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"las... | Extract class name from canonical Java class name
@param canonicalJavaClassName canonical class name (like 'a.b.c.SomeClassName'), must not be null
@return extracted class name, must not be null but can be empty for case "a.b.c.d." | [
"Extract",
"class",
"name",
"from",
"canonical",
"Java",
"class",
"name"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp-plugins/jbbp-plugin-common/src/main/java/com/igormaznitsa/jbbp/plugin/common/utils/CommonUtils.java#L59-L66 | train |
raydac/java-binary-block-parser | jbbp-plugins/jbbp-plugin-common/src/main/java/com/igormaznitsa/jbbp/plugin/common/utils/CommonUtils.java | CommonUtils.extractPackageName | @Nonnull
public static String extractPackageName(@Nonnull final String fileNameWithoutExtension) {
final int lastDot = fileNameWithoutExtension.lastIndexOf('.');
if (lastDot < 0) {
return "";
}
return fileNameWithoutExtension.substring(0, lastDot).trim();
} | java | @Nonnull
public static String extractPackageName(@Nonnull final String fileNameWithoutExtension) {
final int lastDot = fileNameWithoutExtension.lastIndexOf('.');
if (lastDot < 0) {
return "";
}
return fileNameWithoutExtension.substring(0, lastDot).trim();
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"extractPackageName",
"(",
"@",
"Nonnull",
"final",
"String",
"fileNameWithoutExtension",
")",
"{",
"final",
"int",
"lastDot",
"=",
"fileNameWithoutExtension",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
... | Extract package name from canonical Java class name
@param fileNameWithoutExtension canonical class name (like 'a.b.c.SomeClassName'), must not be null
@return extracted package name, must not be null but can be empty | [
"Extract",
"package",
"name",
"from",
"canonical",
"Java",
"class",
"name"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp-plugins/jbbp-plugin-common/src/main/java/com/igormaznitsa/jbbp/plugin/common/utils/CommonUtils.java#L74-L81 | train |
raydac/java-binary-block-parser | jbbp-plugins/jbbp-plugin-common/src/main/java/com/igormaznitsa/jbbp/plugin/common/utils/CommonUtils.java | CommonUtils.scriptFileToJavaFile | @Nonnull
public static File scriptFileToJavaFile(@Nullable final File targetDir, @Nullable final String classPackage, @Nonnull final File scriptFile) {
final String rawFileName = FilenameUtils.getBaseName(scriptFile.getName());
final String className = CommonUtils.extractClassName(rawFileName);
final Stri... | java | @Nonnull
public static File scriptFileToJavaFile(@Nullable final File targetDir, @Nullable final String classPackage, @Nonnull final File scriptFile) {
final String rawFileName = FilenameUtils.getBaseName(scriptFile.getName());
final String className = CommonUtils.extractClassName(rawFileName);
final Stri... | [
"@",
"Nonnull",
"public",
"static",
"File",
"scriptFileToJavaFile",
"(",
"@",
"Nullable",
"final",
"File",
"targetDir",
",",
"@",
"Nullable",
"final",
"String",
"classPackage",
",",
"@",
"Nonnull",
"final",
"File",
"scriptFile",
")",
"{",
"final",
"String",
"r... | Convert script file into path to Java class file.
@param targetDir the target dir for generated sources, it can be null
@param classPackage class package to override extracted one from script name, it can be null
@param scriptFile the script file, must not be null
@return java source file for the script file | [
"Convert",
"script",
"file",
"into",
"path",
"to",
"Java",
"class",
"file",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp-plugins/jbbp-plugin-common/src/main/java/com/igormaznitsa/jbbp/plugin/common/utils/CommonUtils.java#L91-L101 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.strToUtf8 | public static byte[] strToUtf8(final String str) {
final ByteBuffer buffer = CHARSET_UTF8.encode(str);
final byte[] bytesArray = new byte[buffer.remaining()];
buffer.get(bytesArray, 0, bytesArray.length);
return bytesArray;
} | java | public static byte[] strToUtf8(final String str) {
final ByteBuffer buffer = CHARSET_UTF8.encode(str);
final byte[] bytesArray = new byte[buffer.remaining()];
buffer.get(bytesArray, 0, bytesArray.length);
return bytesArray;
} | [
"public",
"static",
"byte",
"[",
"]",
"strToUtf8",
"(",
"final",
"String",
"str",
")",
"{",
"final",
"ByteBuffer",
"buffer",
"=",
"CHARSET_UTF8",
".",
"encode",
"(",
"str",
")",
";",
"final",
"byte",
"[",
"]",
"bytesArray",
"=",
"new",
"byte",
"[",
"bu... | Convert a string into its UTF8 representation.
@param str string to be converted, must not be null
@return array of chars from the string in utf8 format, must not be null
@since 1.4.0 | [
"Convert",
"a",
"string",
"into",
"its",
"UTF8",
"representation",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L56-L61 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.isNumber | public static boolean isNumber(final String num) {
if (num == null || num.length() == 0) {
return false;
}
final boolean firstIsDigit = Character.isDigit(num.charAt(0));
if (!firstIsDigit && num.charAt(0) != '-') {
return false;
}
boolean dig = firstIsDigit;
for (int i = 1; i < n... | java | public static boolean isNumber(final String num) {
if (num == null || num.length() == 0) {
return false;
}
final boolean firstIsDigit = Character.isDigit(num.charAt(0));
if (!firstIsDigit && num.charAt(0) != '-') {
return false;
}
boolean dig = firstIsDigit;
for (int i = 1; i < n... | [
"public",
"static",
"boolean",
"isNumber",
"(",
"final",
"String",
"num",
")",
"{",
"if",
"(",
"num",
"==",
"null",
"||",
"num",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"final",
"boolean",
"firstIsDigit",
"=",
"Char... | Check that a string is a number.
@param num a string to be checked, it can be null
@return true if the string represents a number, false if it is not number
or it is null | [
"Check",
"that",
"a",
"string",
"is",
"a",
"number",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L81-L97 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.packInt | public static byte[] packInt(final int value) {
if ((value & 0xFFFFFF80) == 0) {
return new byte[] {(byte) value};
} else if ((value & 0xFFFF0000) == 0) {
return new byte[] {(byte) 0x80, (byte) (value >>> 8), (byte) value};
} else {
return new byte[] {(byte) 0x81, (byte) (value >>> 24), (b... | java | public static byte[] packInt(final int value) {
if ((value & 0xFFFFFF80) == 0) {
return new byte[] {(byte) value};
} else if ((value & 0xFFFF0000) == 0) {
return new byte[] {(byte) 0x80, (byte) (value >>> 8), (byte) value};
} else {
return new byte[] {(byte) 0x81, (byte) (value >>> 24), (b... | [
"public",
"static",
"byte",
"[",
"]",
"packInt",
"(",
"final",
"int",
"value",
")",
"{",
"if",
"(",
"(",
"value",
"&",
"0xFFFFFF80",
")",
"==",
"0",
")",
"{",
"return",
"new",
"byte",
"[",
"]",
"{",
"(",
"byte",
")",
"value",
"}",
";",
"}",
"el... | Pack an integer value as a byte array.
@param value a code to be packed
@return a byte array contains the packed code | [
"Pack",
"an",
"integer",
"value",
"as",
"a",
"byte",
"array",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L105-L113 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.packInt | public static int packInt(final byte[] array, final JBBPIntCounter position, final int value) {
if ((value & 0xFFFFFF80) == 0) {
array[position.getAndIncrement()] = (byte) value;
return 1;
} else if ((value & 0xFFFF0000) == 0) {
array[position.getAndIncrement()] = (byte) 0x80;
array[posi... | java | public static int packInt(final byte[] array, final JBBPIntCounter position, final int value) {
if ((value & 0xFFFFFF80) == 0) {
array[position.getAndIncrement()] = (byte) value;
return 1;
} else if ((value & 0xFFFF0000) == 0) {
array[position.getAndIncrement()] = (byte) 0x80;
array[posi... | [
"public",
"static",
"int",
"packInt",
"(",
"final",
"byte",
"[",
"]",
"array",
",",
"final",
"JBBPIntCounter",
"position",
",",
"final",
"int",
"value",
")",
"{",
"if",
"(",
"(",
"value",
"&",
"0xFFFFFF80",
")",
"==",
"0",
")",
"{",
"array",
"[",
"po... | Pack an integer value and save that into a byte array since defined
position.
@param array a byte array where to write the packed data, it must not be
null
@param position the position of the first byte of the packed value, it must
not be null
@param value the value to be packed
@return number of bytes written i... | [
"Pack",
"an",
"integer",
"value",
"and",
"save",
"that",
"into",
"a",
"byte",
"array",
"since",
"defined",
"position",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L127-L143 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.unpackInt | public static int unpackInt(final byte[] array, final JBBPIntCounter position) {
final int code = array[position.getAndIncrement()] & 0xFF;
if (code < 0x80) {
return code;
}
final int result;
switch (code) {
case 0x80: {
result = ((array[position.getAndIncrement()] & 0xFF) << 8)... | java | public static int unpackInt(final byte[] array, final JBBPIntCounter position) {
final int code = array[position.getAndIncrement()] & 0xFF;
if (code < 0x80) {
return code;
}
final int result;
switch (code) {
case 0x80: {
result = ((array[position.getAndIncrement()] & 0xFF) << 8)... | [
"public",
"static",
"int",
"unpackInt",
"(",
"final",
"byte",
"[",
"]",
"array",
",",
"final",
"JBBPIntCounter",
"position",
")",
"{",
"final",
"int",
"code",
"=",
"array",
"[",
"position",
".",
"getAndIncrement",
"(",
")",
"]",
"&",
"0xFF",
";",
"if",
... | Unpack an integer value from defined position in a byte array.
@param array the source byte array
@param position the position of the first byte of packed value
@return the unpacked value, the position will be increased | [
"Unpack",
"an",
"integer",
"value",
"from",
"defined",
"position",
"in",
"a",
"byte",
"array",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L152-L175 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.byteArray2String | public static String byteArray2String(final byte[] array, final String prefix, final String delimiter, final boolean brackets, final int radix) {
if (array == null) {
return null;
}
final int maxlen = Integer.toString(0xFF, radix).length();
final String zero = "00000000";
final String normDe... | java | public static String byteArray2String(final byte[] array, final String prefix, final String delimiter, final boolean brackets, final int radix) {
if (array == null) {
return null;
}
final int maxlen = Integer.toString(0xFF, radix).length();
final String zero = "00000000";
final String normDe... | [
"public",
"static",
"String",
"byteArray2String",
"(",
"final",
"byte",
"[",
"]",
"array",
",",
"final",
"String",
"prefix",
",",
"final",
"String",
"delimiter",
",",
"final",
"boolean",
"brackets",
",",
"final",
"int",
"radix",
")",
"{",
"if",
"(",
"array... | Convert a byte array into string representation
@param array the array to be converted, it must not be null
@param prefix the prefix for each converted value, it can be null
@param delimiter the delimeter for string representations
@param brackets if true then place the result into square brackets
@param radix... | [
"Convert",
"a",
"byte",
"array",
"into",
"string",
"representation"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L217-L257 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.reverseBitsInByte | public static byte reverseBitsInByte(final JBBPBitNumber bitNumber, final byte value) {
final byte reversed = reverseBitsInByte(value);
return (byte) ((reversed >>> (8 - bitNumber.getBitNumber())) & bitNumber.getMask());
} | java | public static byte reverseBitsInByte(final JBBPBitNumber bitNumber, final byte value) {
final byte reversed = reverseBitsInByte(value);
return (byte) ((reversed >>> (8 - bitNumber.getBitNumber())) & bitNumber.getMask());
} | [
"public",
"static",
"byte",
"reverseBitsInByte",
"(",
"final",
"JBBPBitNumber",
"bitNumber",
",",
"final",
"byte",
"value",
")",
"{",
"final",
"byte",
"reversed",
"=",
"reverseBitsInByte",
"(",
"value",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"revers... | Reverse lower part of a byte defined by bits number constant.
@param bitNumber number of lowest bits to be reversed, must not be null
@param value a byte to be processed
@return value contains reversed number of lowest bits of the byte | [
"Reverse",
"lower",
"part",
"of",
"a",
"byte",
"defined",
"by",
"bits",
"number",
"constant",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L278-L281 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.bin2str | public static String bin2str(final byte[] values, final JBBPBitOrder bitOrder, final boolean separateBytes) {
if (values == null) {
return null;
}
final StringBuilder result = new StringBuilder(values.length * (separateBytes ? 9 : 8));
boolean nofirst = false;
for (final byte b : values) {
... | java | public static String bin2str(final byte[] values, final JBBPBitOrder bitOrder, final boolean separateBytes) {
if (values == null) {
return null;
}
final StringBuilder result = new StringBuilder(values.length * (separateBytes ? 9 : 8));
boolean nofirst = false;
for (final byte b : values) {
... | [
"public",
"static",
"String",
"bin2str",
"(",
"final",
"byte",
"[",
"]",
"values",
",",
"final",
"JBBPBitOrder",
"bitOrder",
",",
"final",
"boolean",
"separateBytes",
")",
"{",
"if",
"(",
"values",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"fin... | Convert a byte array into string binary representation with defined bit
order and possibility to separate bytes.
@param values a byte array to be converted
@param bitOrder the bit order for byte decoding
@param separateBytes if true then bytes will be separated by spaces
@return the string representation o... | [
"Convert",
"a",
"byte",
"array",
"into",
"string",
"binary",
"representation",
"with",
"defined",
"bit",
"order",
"and",
"possibility",
"to",
"separate",
"bytes",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L314-L347 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.fieldsAsList | public static List<JBBPAbstractField> fieldsAsList(final JBBPAbstractField... fields) {
final List<JBBPAbstractField> result = new ArrayList<>();
Collections.addAll(result, fields);
return result;
} | java | public static List<JBBPAbstractField> fieldsAsList(final JBBPAbstractField... fields) {
final List<JBBPAbstractField> result = new ArrayList<>();
Collections.addAll(result, fields);
return result;
} | [
"public",
"static",
"List",
"<",
"JBBPAbstractField",
">",
"fieldsAsList",
"(",
"final",
"JBBPAbstractField",
"...",
"fields",
")",
"{",
"final",
"List",
"<",
"JBBPAbstractField",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Collections",
".",... | Convert array of JBBP fields into a list.
@param fields an array of fields, must not be null
@return a list of JBBP fields | [
"Convert",
"array",
"of",
"JBBP",
"fields",
"into",
"a",
"list",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L355-L359 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.splitString | public static String[] splitString(final String str, final char splitChar) {
final int length = str.length();
final StringBuilder bulder = new StringBuilder(Math.max(8, length));
int counter = 1;
for (int i = 0; i < length; i++) {
if (str.charAt(i) == splitChar) {
counter++;
}
}... | java | public static String[] splitString(final String str, final char splitChar) {
final int length = str.length();
final StringBuilder bulder = new StringBuilder(Math.max(8, length));
int counter = 1;
for (int i = 0; i < length; i++) {
if (str.charAt(i) == splitChar) {
counter++;
}
}... | [
"public",
"static",
"String",
"[",
"]",
"splitString",
"(",
"final",
"String",
"str",
",",
"final",
"char",
"splitChar",
")",
"{",
"final",
"int",
"length",
"=",
"str",
".",
"length",
"(",
")",
";",
"final",
"StringBuilder",
"bulder",
"=",
"new",
"String... | Split a string for a char used as the delimeter.
@param str a string to be split
@param splitChar a char to be used as delimeter
@return array contains split string parts without delimeter chars | [
"Split",
"a",
"string",
"for",
"a",
"char",
"used",
"as",
"the",
"delimeter",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L441-L469 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.assertNotNull | public static void assertNotNull(final Object object, final String message) {
if (object == null) {
throw new NullPointerException(message == null ? "Object is null" : message);
}
} | java | public static void assertNotNull(final Object object, final String message) {
if (object == null) {
throw new NullPointerException(message == null ? "Object is null" : message);
}
} | [
"public",
"static",
"void",
"assertNotNull",
"(",
"final",
"Object",
"object",
",",
"final",
"String",
"message",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"message",
"==",
"null",
"?",
"\"Object is n... | Check that an object is null and throw NullPointerException in the case.
@param object an object to be checked
@param message message to be used as the exception message
@throws NullPointerException it will be thrown if the object is null | [
"Check",
"that",
"an",
"object",
"is",
"null",
"and",
"throw",
"NullPointerException",
"in",
"the",
"case",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L478-L482 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.int2msg | public static String int2msg(final int number) {
return number + " (0x" + Long.toHexString((long) number & 0xFFFFFFFFL).toUpperCase(Locale.ENGLISH) + ')';
} | java | public static String int2msg(final int number) {
return number + " (0x" + Long.toHexString((long) number & 0xFFFFFFFFL).toUpperCase(Locale.ENGLISH) + ')';
} | [
"public",
"static",
"String",
"int2msg",
"(",
"final",
"int",
"number",
")",
"{",
"return",
"number",
"+",
"\" (0x\"",
"+",
"Long",
".",
"toHexString",
"(",
"(",
"long",
")",
"number",
"&",
"0xFFFFFFFF",
"L",
")",
".",
"toUpperCase",
"(",
"Locale",
".",
... | Convert an integer number into human readable hexadecimal format.
@param number a number to be converted
@return a string with human readable hexadecimal number representation | [
"Convert",
"an",
"integer",
"number",
"into",
"human",
"readable",
"hexadecimal",
"format",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L490-L492 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.normalizeFieldNameOrPath | public static String normalizeFieldNameOrPath(final String nameOrPath) {
assertNotNull(nameOrPath, "Name of path must not be null");
return nameOrPath.trim().toLowerCase(Locale.ENGLISH);
} | java | public static String normalizeFieldNameOrPath(final String nameOrPath) {
assertNotNull(nameOrPath, "Name of path must not be null");
return nameOrPath.trim().toLowerCase(Locale.ENGLISH);
} | [
"public",
"static",
"String",
"normalizeFieldNameOrPath",
"(",
"final",
"String",
"nameOrPath",
")",
"{",
"assertNotNull",
"(",
"nameOrPath",
",",
"\"Name of path must not be null\"",
")",
";",
"return",
"nameOrPath",
".",
"trim",
"(",
")",
".",
"toLowerCase",
"(",
... | Normalize field name or path.
@param nameOrPath a field name or a path to be normalized, must not be null
@return the normalized version of the name or path | [
"Normalize",
"field",
"name",
"or",
"path",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L500-L503 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.str2UnicodeByteArray | public static byte[] str2UnicodeByteArray(final JBBPByteOrder byteOrder, final String str) {
final byte[] result = new byte[str.length() << 1];
int index = 0;
for (int i = 0; i < str.length(); i++) {
final int val = str.charAt(i);
switch (byteOrder) {
case BIG_ENDIAN: {
result[... | java | public static byte[] str2UnicodeByteArray(final JBBPByteOrder byteOrder, final String str) {
final byte[] result = new byte[str.length() << 1];
int index = 0;
for (int i = 0; i < str.length(); i++) {
final int val = str.charAt(i);
switch (byteOrder) {
case BIG_ENDIAN: {
result[... | [
"public",
"static",
"byte",
"[",
"]",
"str2UnicodeByteArray",
"(",
"final",
"JBBPByteOrder",
"byteOrder",
",",
"final",
"String",
"str",
")",
"{",
"final",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"str",
".",
"length",
"(",
")",
"<<",
"1",
... | Convert chars of a string into a byte array contains the unicode codes.
@param byteOrder the byte order for the operation, must not be null
@param str the string which chars should be written, must not be null
@return the byte array contains unicodes of the string written as byte
pairs
@since 1.1 | [
"Convert",
"chars",
"of",
"a",
"string",
"into",
"a",
"byte",
"array",
"contains",
"the",
"unicode",
"codes",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L529-L550 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.reverseArray | public static byte[] reverseArray(final byte[] nullableArrayToBeInverted) {
if (nullableArrayToBeInverted != null && nullableArrayToBeInverted.length > 0) {
int indexStart = 0;
int indexEnd = nullableArrayToBeInverted.length - 1;
while (indexStart < indexEnd) {
final byte a = nullableArray... | java | public static byte[] reverseArray(final byte[] nullableArrayToBeInverted) {
if (nullableArrayToBeInverted != null && nullableArrayToBeInverted.length > 0) {
int indexStart = 0;
int indexEnd = nullableArrayToBeInverted.length - 1;
while (indexStart < indexEnd) {
final byte a = nullableArray... | [
"public",
"static",
"byte",
"[",
"]",
"reverseArray",
"(",
"final",
"byte",
"[",
"]",
"nullableArrayToBeInverted",
")",
"{",
"if",
"(",
"nullableArrayToBeInverted",
"!=",
"null",
"&&",
"nullableArrayToBeInverted",
".",
"length",
">",
"0",
")",
"{",
"int",
"ind... | Reverse order of bytes in a byte array.
@param nullableArrayToBeInverted a byte array which order must be reversed,
it can be null
@return the same array instance but with reversed byte order, null if the
source array is null
@since 1.1 | [
"Reverse",
"order",
"of",
"bytes",
"in",
"a",
"byte",
"array",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L561-L574 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.splitInteger | public static byte[] splitInteger(final int value, final boolean valueInLittleEndian, final byte[] buffer) {
final byte[] result;
if (buffer == null || buffer.length < 4) {
result = new byte[4];
} else {
result = buffer;
}
int tmpvalue = value;
if (valueInLittleEndian) {
for (i... | java | public static byte[] splitInteger(final int value, final boolean valueInLittleEndian, final byte[] buffer) {
final byte[] result;
if (buffer == null || buffer.length < 4) {
result = new byte[4];
} else {
result = buffer;
}
int tmpvalue = value;
if (valueInLittleEndian) {
for (i... | [
"public",
"static",
"byte",
"[",
"]",
"splitInteger",
"(",
"final",
"int",
"value",
",",
"final",
"boolean",
"valueInLittleEndian",
",",
"final",
"byte",
"[",
"]",
"buffer",
")",
"{",
"final",
"byte",
"[",
"]",
"result",
";",
"if",
"(",
"buffer",
"==",
... | Split an integer value to bytes and returns as a byte array.
@param value a value to be split
@param valueInLittleEndian the flag shows that the integer is presented in
the little endian form
@param buffer a buffer array to be used as a storage, if the array is null
or its length is less tha... | [
"Split",
"an",
"integer",
"value",
"to",
"bytes",
"and",
"returns",
"as",
"a",
"byte",
"array",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L588-L608 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.concat | public static byte[] concat(final byte[]... arrays) {
int len = 0;
for (final byte[] arr : arrays) {
len += arr.length;
}
final byte[] result = new byte[len];
int pos = 0;
for (final byte[] arr : arrays) {
System.arraycopy(arr, 0, result, pos, arr.length);
pos += arr.length;
... | java | public static byte[] concat(final byte[]... arrays) {
int len = 0;
for (final byte[] arr : arrays) {
len += arr.length;
}
final byte[] result = new byte[len];
int pos = 0;
for (final byte[] arr : arrays) {
System.arraycopy(arr, 0, result, pos, arr.length);
pos += arr.length;
... | [
"public",
"static",
"byte",
"[",
"]",
"concat",
"(",
"final",
"byte",
"[",
"]",
"...",
"arrays",
")",
"{",
"int",
"len",
"=",
"0",
";",
"for",
"(",
"final",
"byte",
"[",
"]",
"arr",
":",
"arrays",
")",
"{",
"len",
"+=",
"arr",
".",
"length",
";... | Concatenate byte arrays into one byte array sequentially.
@param arrays arrays to be concatenated
@return the result byte array contains concatenated source arrays
@since 1.1 | [
"Concatenate",
"byte",
"arrays",
"into",
"one",
"byte",
"array",
"sequentially",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L651-L664 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.reverseByteOrder | public static long reverseByteOrder(long value, int numOfLowerBytesToInvert) {
if (numOfLowerBytesToInvert < 1 || numOfLowerBytesToInvert > 8) {
throw new IllegalArgumentException("Wrong number of bytes [" + numOfLowerBytesToInvert + ']');
}
long result = 0;
int offsetInResult = (numOfLowerBytes... | java | public static long reverseByteOrder(long value, int numOfLowerBytesToInvert) {
if (numOfLowerBytesToInvert < 1 || numOfLowerBytesToInvert > 8) {
throw new IllegalArgumentException("Wrong number of bytes [" + numOfLowerBytesToInvert + ']');
}
long result = 0;
int offsetInResult = (numOfLowerBytes... | [
"public",
"static",
"long",
"reverseByteOrder",
"(",
"long",
"value",
",",
"int",
"numOfLowerBytesToInvert",
")",
"{",
"if",
"(",
"numOfLowerBytesToInvert",
"<",
"1",
"||",
"numOfLowerBytesToInvert",
">",
"8",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Revert order for defined number of bytes in a value.
@param value the value which bytes should be reordered
@param numOfLowerBytesToInvert number of lower bytes to be reverted in
their order, must be 1..8
@return new value which has reverted order for defined number of lower
bytes
@since 1.1 | [
"Revert",
"order",
"for",
"defined",
"number",
"of",
"bytes",
"in",
"a",
"value",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L676-L693 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.double2str | public static String double2str(final double doubleValue, final int radix) {
if (radix != 10 && radix != 16) {
throw new IllegalArgumentException("Illegal radix [" + radix + ']');
}
final String result;
if (radix == 16) {
String converted = Double.toHexString(doubleValue);
boolean min... | java | public static String double2str(final double doubleValue, final int radix) {
if (radix != 10 && radix != 16) {
throw new IllegalArgumentException("Illegal radix [" + radix + ']');
}
final String result;
if (radix == 16) {
String converted = Double.toHexString(doubleValue);
boolean min... | [
"public",
"static",
"String",
"double2str",
"(",
"final",
"double",
"doubleValue",
",",
"final",
"int",
"radix",
")",
"{",
"if",
"(",
"radix",
"!=",
"10",
"&&",
"radix",
"!=",
"16",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Illegal radix ... | Convert double value into string representation with defined radix
base.
@param doubleValue value to be converted in string
@param radix radix base to be used for conversion, must be 10 or 16
@return converted value as upper case string
@throws IllegalArgumentException for wrong radix base
@since 1.4.0 | [
"Convert",
"double",
"value",
"into",
"string",
"representation",
"with",
"defined",
"radix",
"base",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L706-L726 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.float2str | public static String float2str(final float floatValue, final int radix) {
if (radix != 10 && radix != 16) {
throw new IllegalArgumentException("Illegal radix [" + radix + ']');
}
final String result;
if (radix == 16) {
String converted = Double.toHexString(floatValue);
boolean minus = ... | java | public static String float2str(final float floatValue, final int radix) {
if (radix != 10 && radix != 16) {
throw new IllegalArgumentException("Illegal radix [" + radix + ']');
}
final String result;
if (radix == 16) {
String converted = Double.toHexString(floatValue);
boolean minus = ... | [
"public",
"static",
"String",
"float2str",
"(",
"final",
"float",
"floatValue",
",",
"final",
"int",
"radix",
")",
"{",
"if",
"(",
"radix",
"!=",
"10",
"&&",
"radix",
"!=",
"16",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Illegal radix [\"... | Convert float value into string representation with defined radix
base.
@param floatValue value to be converted in string
@param radix radix base to be used for conversion, must be 10 or 16
@return converted value as upper case string
@throws IllegalArgumentException for wrong radix base
@since 1.4.0 | [
"Convert",
"float",
"value",
"into",
"string",
"representation",
"with",
"defined",
"radix",
"base",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L738-L757 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.ulong2str | public static String ulong2str(final long ulongValue, final int radix, final char[] charBuffer) {
if (radix < 2 || radix > 36) {
throw new IllegalArgumentException("Illegal radix [" + radix + ']');
}
if (ulongValue == 0) {
return "0";
} else {
final String result;
if (ulongValue... | java | public static String ulong2str(final long ulongValue, final int radix, final char[] charBuffer) {
if (radix < 2 || radix > 36) {
throw new IllegalArgumentException("Illegal radix [" + radix + ']');
}
if (ulongValue == 0) {
return "0";
} else {
final String result;
if (ulongValue... | [
"public",
"static",
"String",
"ulong2str",
"(",
"final",
"long",
"ulongValue",
",",
"final",
"int",
"radix",
",",
"final",
"char",
"[",
"]",
"charBuffer",
")",
"{",
"if",
"(",
"radix",
"<",
"2",
"||",
"radix",
">",
"36",
")",
"{",
"throw",
"new",
"Il... | Convert unsigned long value into string representation with defined radix
base.
@param ulongValue value to be converted in string
@param radix radix base to be used for conversion, must be 2..36
@param charBuffer char buffer to be used for conversion operations, should
be not less than 64 char length, if length i... | [
"Convert",
"unsigned",
"long",
"value",
"into",
"string",
"representation",
"with",
"defined",
"radix",
"base",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L773-L800 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.ensureMinTextLength | public static String ensureMinTextLength(final String text, final int neededLen, final char ch, final int mode) {
final int number = neededLen - text.length();
if (number <= 0) {
return text;
}
final StringBuilder result = new StringBuilder(neededLen);
switch (mode) {
case 0: {
... | java | public static String ensureMinTextLength(final String text, final int neededLen, final char ch, final int mode) {
final int number = neededLen - text.length();
if (number <= 0) {
return text;
}
final StringBuilder result = new StringBuilder(neededLen);
switch (mode) {
case 0: {
... | [
"public",
"static",
"String",
"ensureMinTextLength",
"(",
"final",
"String",
"text",
",",
"final",
"int",
"neededLen",
",",
"final",
"char",
"ch",
",",
"final",
"int",
"mode",
")",
"{",
"final",
"int",
"number",
"=",
"neededLen",
"-",
"text",
".",
"length"... | Extend text by chars to needed length.
@param text text to be extended, must not be null.
@param neededLen needed length for text
@param ch char to be used for extending
@param mode 0 to extend left, 1 to extend right, otherwise extends both
sides
@return text extended by chars up to needed length, or... | [
"Extend",
"text",
"by",
"chars",
"to",
"needed",
"length",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L814-L850 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.removeLeadingZeros | public static String removeLeadingZeros(final String str) {
String result = str;
if (str != null && str.length() != 0) {
int startIndex = 0;
while (startIndex < str.length() - 1) {
final char ch = str.charAt(startIndex);
if (ch != '0') {
break;
}
startIndex+... | java | public static String removeLeadingZeros(final String str) {
String result = str;
if (str != null && str.length() != 0) {
int startIndex = 0;
while (startIndex < str.length() - 1) {
final char ch = str.charAt(startIndex);
if (ch != '0') {
break;
}
startIndex+... | [
"public",
"static",
"String",
"removeLeadingZeros",
"(",
"final",
"String",
"str",
")",
"{",
"String",
"result",
"=",
"str",
";",
"if",
"(",
"str",
"!=",
"null",
"&&",
"str",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"int",
"startIndex",
"=",
"0"... | Remove leading zeros from string.
@param str the string to be trimmed
@return the result string without left extra zeros, or null if argument is
null
@since 1.1 | [
"Remove",
"leading",
"zeros",
"from",
"string",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L860-L876 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.removeTrailingZeros | public static String removeTrailingZeros(final String str) {
String result = str;
if (str != null && str.length() != 0) {
int endIndex = str.length();
while (endIndex > 1) {
final char ch = str.charAt(endIndex - 1);
if (ch != '0') {
break;
}
endIndex--;
... | java | public static String removeTrailingZeros(final String str) {
String result = str;
if (str != null && str.length() != 0) {
int endIndex = str.length();
while (endIndex > 1) {
final char ch = str.charAt(endIndex - 1);
if (ch != '0') {
break;
}
endIndex--;
... | [
"public",
"static",
"String",
"removeTrailingZeros",
"(",
"final",
"String",
"str",
")",
"{",
"String",
"result",
"=",
"str",
";",
"if",
"(",
"str",
"!=",
"null",
"&&",
"str",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"int",
"endIndex",
"=",
"str... | Remove trailing zeros from string.
@param str the string to be trimmed
@return the result string without left extra zeros, or null if argument is
null
@since 1.1 | [
"Remove",
"trailing",
"zeros",
"from",
"string",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L886-L902 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.arrayStartsWith | public static boolean arrayStartsWith(final byte[] array, final byte[] str) {
boolean result = false;
if (array.length >= str.length) {
result = true;
int index = str.length;
while (--index >= 0) {
if (array[index] != str[index]) {
result = false;
break;
}
... | java | public static boolean arrayStartsWith(final byte[] array, final byte[] str) {
boolean result = false;
if (array.length >= str.length) {
result = true;
int index = str.length;
while (--index >= 0) {
if (array[index] != str[index]) {
result = false;
break;
}
... | [
"public",
"static",
"boolean",
"arrayStartsWith",
"(",
"final",
"byte",
"[",
"]",
"array",
",",
"final",
"byte",
"[",
"]",
"str",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"array",
".",
"length",
">=",
"str",
".",
"length",
")",
"{... | Check that a byte array starts with some byte values.
@param array array to be checked, must not be null
@param str a byte string which will be checked as the start sequence of the
array, must not be null
@return true if the string is the start sequence of the array, false
otherwise
@throws NullPointerException if a... | [
"Check",
"that",
"a",
"byte",
"array",
"starts",
"with",
"some",
"byte",
"values",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L915-L928 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.arrayEndsWith | public static boolean arrayEndsWith(final byte[] array, final byte[] str) {
boolean result = false;
if (array.length >= str.length) {
result = true;
int index = str.length;
int arrindex = array.length;
while (--index >= 0) {
if (array[--arrindex] != str[index]) {
result... | java | public static boolean arrayEndsWith(final byte[] array, final byte[] str) {
boolean result = false;
if (array.length >= str.length) {
result = true;
int index = str.length;
int arrindex = array.length;
while (--index >= 0) {
if (array[--arrindex] != str[index]) {
result... | [
"public",
"static",
"boolean",
"arrayEndsWith",
"(",
"final",
"byte",
"[",
"]",
"array",
",",
"final",
"byte",
"[",
"]",
"str",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"array",
".",
"length",
">=",
"str",
".",
"length",
")",
"{",... | Check that a byte array ends with some byte values.
@param array array to be checked, must not be null
@param str a byte string which will be checked as the end sequence of the
array, must not be null
@return true if the string is the end sequence of the array, false
otherwise
@throws NullPointerException if any arg... | [
"Check",
"that",
"a",
"byte",
"array",
"ends",
"with",
"some",
"byte",
"values",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L941-L955 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/tokenizer/JBBPTokenizer.java | JBBPTokenizer.checkFieldName | private JBBPTokenizerException checkFieldName(final String name, final int position) {
if (name != null) {
final String normalized = JBBPUtils.normalizeFieldNameOrPath(name);
if (normalized.indexOf('.') >= 0) {
return new JBBPTokenizerException("Field name must not contain '.' char", position);
... | java | private JBBPTokenizerException checkFieldName(final String name, final int position) {
if (name != null) {
final String normalized = JBBPUtils.normalizeFieldNameOrPath(name);
if (normalized.indexOf('.') >= 0) {
return new JBBPTokenizerException("Field name must not contain '.' char", position);
... | [
"private",
"JBBPTokenizerException",
"checkFieldName",
"(",
"final",
"String",
"name",
",",
"final",
"int",
"position",
")",
"{",
"if",
"(",
"name",
"!=",
"null",
")",
"{",
"final",
"String",
"normalized",
"=",
"JBBPUtils",
".",
"normalizeFieldNameOrPath",
"(",
... | Check a field name
@param name the name to be checked.
@param position the token position in the string.
@return JBBPTokenizerException if the field name has wrong chars or
presented in disabled name set, null otherwise | [
"Check",
"a",
"field",
"name"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/tokenizer/JBBPTokenizer.java#L255-L280 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompilerUtils.java | JBBPCompilerUtils.findIndexForFieldPath | public static int findIndexForFieldPath(final String fieldPath, final List<JBBPNamedFieldInfo> namedFields) {
final String normalized = JBBPUtils.normalizeFieldNameOrPath(fieldPath);
int result = -1;
for (int i = namedFields.size() - 1; i >= 0; i--) {
final JBBPNamedFieldInfo f = namedFields.get(i);
... | java | public static int findIndexForFieldPath(final String fieldPath, final List<JBBPNamedFieldInfo> namedFields) {
final String normalized = JBBPUtils.normalizeFieldNameOrPath(fieldPath);
int result = -1;
for (int i = namedFields.size() - 1; i >= 0; i--) {
final JBBPNamedFieldInfo f = namedFields.get(i);
... | [
"public",
"static",
"int",
"findIndexForFieldPath",
"(",
"final",
"String",
"fieldPath",
",",
"final",
"List",
"<",
"JBBPNamedFieldInfo",
">",
"namedFields",
")",
"{",
"final",
"String",
"normalized",
"=",
"JBBPUtils",
".",
"normalizeFieldNameOrPath",
"(",
"fieldPat... | Find a named field info index in a list for its path.
@param fieldPath a field path, it must not be null.
@param namedFields a list contains named field info items.
@return the index of a field for the path if found one, -1 otherwise | [
"Find",
"a",
"named",
"field",
"info",
"index",
"in",
"a",
"list",
"for",
"its",
"path",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompilerUtils.java#L42-L53 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompilerUtils.java | JBBPCompilerUtils.assertFieldIsNotArrayOrInArray | public static void assertFieldIsNotArrayOrInArray(final JBBPNamedFieldInfo fieldToCheck, final List<JBBPNamedFieldInfo> namedFieldList, final byte[] compiledScript) {
// check that the field is not array
if ((compiledScript[fieldToCheck.getFieldOffsetInCompiledBlock()] & FLAG_ARRAY) != 0) {
throw new JBBP... | java | public static void assertFieldIsNotArrayOrInArray(final JBBPNamedFieldInfo fieldToCheck, final List<JBBPNamedFieldInfo> namedFieldList, final byte[] compiledScript) {
// check that the field is not array
if ((compiledScript[fieldToCheck.getFieldOffsetInCompiledBlock()] & FLAG_ARRAY) != 0) {
throw new JBBP... | [
"public",
"static",
"void",
"assertFieldIsNotArrayOrInArray",
"(",
"final",
"JBBPNamedFieldInfo",
"fieldToCheck",
",",
"final",
"List",
"<",
"JBBPNamedFieldInfo",
">",
"namedFieldList",
",",
"final",
"byte",
"[",
"]",
"compiledScript",
")",
"{",
"// check that the field... | Check a field in a compiled list defined by its named field info, that the field is not an array and it is not inside a structure array.
@param fieldToCheck a named field info to be checked, must not be null
@param namedFieldList a named field info list, must not be null.
@param compiledScript a compiled script body | [
"Check",
"a",
"field",
"in",
"a",
"compiled",
"list",
"defined",
"by",
"its",
"named",
"field",
"info",
"that",
"the",
"field",
"is",
"not",
"an",
"array",
"and",
"it",
"is",
"not",
"inside",
"a",
"structure",
"array",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompilerUtils.java#L82-L103 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/varlen/JBBPExpressionEvaluator.java | JBBPExpressionEvaluator.codeToUnary | private static int codeToUnary(final int code) {
final int result;
switch (code) {
case CODE_MINUS:
result = CODE_UNARYMINUS;
break;
case CODE_ADD:
result = CODE_UNARYPLUS;
break;
default:
result = code;
break;
}
return result;
} | java | private static int codeToUnary(final int code) {
final int result;
switch (code) {
case CODE_MINUS:
result = CODE_UNARYMINUS;
break;
case CODE_ADD:
result = CODE_UNARYPLUS;
break;
default:
result = code;
break;
}
return result;
} | [
"private",
"static",
"int",
"codeToUnary",
"(",
"final",
"int",
"code",
")",
"{",
"final",
"int",
"result",
";",
"switch",
"(",
"code",
")",
"{",
"case",
"CODE_MINUS",
":",
"result",
"=",
"CODE_UNARYMINUS",
";",
"break",
";",
"case",
"CODE_ADD",
":",
"re... | Encode code of an operator to code of similar unary operator.
@param code a code of operator.
@return code of an unary similar operator if it exists, the same code otherwise | [
"Encode",
"code",
"of",
"an",
"operator",
"to",
"code",
"of",
"similar",
"unary",
"operator",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/varlen/JBBPExpressionEvaluator.java#L428-L443 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/varlen/JBBPExpressionEvaluator.java | JBBPExpressionEvaluator.hasExpressionOperators | public static boolean hasExpressionOperators(final String str) {
boolean result = false;
for (final char chr : OPERATOR_FIRST_CHARS) {
if (str.indexOf(chr) >= 0) {
result = true;
break;
}
}
return result;
} | java | public static boolean hasExpressionOperators(final String str) {
boolean result = false;
for (final char chr : OPERATOR_FIRST_CHARS) {
if (str.indexOf(chr) >= 0) {
result = true;
break;
}
}
return result;
} | [
"public",
"static",
"boolean",
"hasExpressionOperators",
"(",
"final",
"String",
"str",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"for",
"(",
"final",
"char",
"chr",
":",
"OPERATOR_FIRST_CHARS",
")",
"{",
"if",
"(",
"str",
".",
"indexOf",
"(",
"chr... | Check that a string has a char of operators.
@param str a string to be checked, must not be null
@return true if the string contains a char of an operator, false otherwise | [
"Check",
"that",
"a",
"string",
"has",
"a",
"char",
"of",
"operators",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/varlen/JBBPExpressionEvaluator.java#L496-L507 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/varlen/JBBPExpressionEvaluator.java | JBBPExpressionEvaluator.assertUnaryOperator | private void assertUnaryOperator(final String operator) {
if (!("+".equals(operator) || "-".equals(operator) || "~".equals(operator))) {
throw new JBBPCompilationException("Wrong unary operator '" + operator + "' [" + this.expressionSource + ']');
}
} | java | private void assertUnaryOperator(final String operator) {
if (!("+".equals(operator) || "-".equals(operator) || "~".equals(operator))) {
throw new JBBPCompilationException("Wrong unary operator '" + operator + "' [" + this.expressionSource + ']');
}
} | [
"private",
"void",
"assertUnaryOperator",
"(",
"final",
"String",
"operator",
")",
"{",
"if",
"(",
"!",
"(",
"\"+\"",
".",
"equals",
"(",
"operator",
")",
"||",
"\"-\"",
".",
"equals",
"(",
"operator",
")",
"||",
"\"~\"",
".",
"equals",
"(",
"operator",
... | Check that a string represents a unary operator.
@param operator an operator to be checked, must not be null.
@throws JBBPCompilationException if the operator is not supported unary operator. | [
"Check",
"that",
"a",
"string",
"represents",
"a",
"unary",
"operator",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/varlen/JBBPExpressionEvaluator.java#L515-L519 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JavaSrcTextBuffer.java | JavaSrcTextBuffer.printf | public JavaSrcTextBuffer printf(final String text, final Object... args) {
this.buffer.append(String.format(text, args));
return this;
} | java | public JavaSrcTextBuffer printf(final String text, final Object... args) {
this.buffer.append(String.format(text, args));
return this;
} | [
"public",
"JavaSrcTextBuffer",
"printf",
"(",
"final",
"String",
"text",
",",
"final",
"Object",
"...",
"args",
")",
"{",
"this",
".",
"buffer",
".",
"append",
"(",
"String",
".",
"format",
"(",
"text",
",",
"args",
")",
")",
";",
"return",
"this",
";"... | Formatted print.
@param text format string
@param args arguments for formatted string
@return this instance
@see String#format(String, Object...) | [
"Formatted",
"print",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JavaSrcTextBuffer.java#L98-L101 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JavaSrcTextBuffer.java | JavaSrcTextBuffer.printLinesWithIndent | public JavaSrcTextBuffer printLinesWithIndent(final String text) {
final String[] splitted = text.split("\n", -1);
for (final String aSplitted : splitted) {
this.indent().println(aSplitted);
}
return this;
} | java | public JavaSrcTextBuffer printLinesWithIndent(final String text) {
final String[] splitted = text.split("\n", -1);
for (final String aSplitted : splitted) {
this.indent().println(aSplitted);
}
return this;
} | [
"public",
"JavaSrcTextBuffer",
"printLinesWithIndent",
"(",
"final",
"String",
"text",
")",
"{",
"final",
"String",
"[",
"]",
"splitted",
"=",
"text",
".",
"split",
"(",
"\"\\n\"",
",",
"-",
"1",
")",
";",
"for",
"(",
"final",
"String",
"aSplitted",
":",
... | Parse string to lines and print each line with current indent
@param text the text to be printed
@return this instance | [
"Parse",
"string",
"to",
"lines",
"and",
"print",
"each",
"line",
"with",
"current",
"indent"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JavaSrcTextBuffer.java#L182-L190 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/tokenizer/JBBPToken.java | JBBPToken.getArraySizeAsInt | public Integer getArraySizeAsInt() {
if (this.arraySize == null) {
throw new NullPointerException("Array size is not defined");
}
try {
return Integer.valueOf(this.arraySize.trim());
} catch (NumberFormatException ex) {
return null;
}
} | java | public Integer getArraySizeAsInt() {
if (this.arraySize == null) {
throw new NullPointerException("Array size is not defined");
}
try {
return Integer.valueOf(this.arraySize.trim());
} catch (NumberFormatException ex) {
return null;
}
} | [
"public",
"Integer",
"getArraySizeAsInt",
"(",
")",
"{",
"if",
"(",
"this",
".",
"arraySize",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Array size is not defined\"",
")",
";",
"}",
"try",
"{",
"return",
"Integer",
".",
"valueOf",
... | Get numeric representation of the array size.
@return the parsed numeric representation of the array size value or null if it can't be parsed
@throws NullPointerException will be thrown if the array size value is null | [
"Get",
"numeric",
"representation",
"of",
"the",
"array",
"size",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/tokenizer/JBBPToken.java#L150-L159 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriterExtraAdapter.java | JBBPTextWriterExtraAdapter.extractFieldValue | public Object extractFieldValue(final Object instance, final Field field) {
JBBPUtils.assertNotNull(field, "Field must not be null");
try {
return ReflectUtils.makeAccessible(field).get(instance);
} catch (Exception ex) {
throw new JBBPException("Can't extract value from field for exception", ex... | java | public Object extractFieldValue(final Object instance, final Field field) {
JBBPUtils.assertNotNull(field, "Field must not be null");
try {
return ReflectUtils.makeAccessible(field).get(instance);
} catch (Exception ex) {
throw new JBBPException("Can't extract value from field for exception", ex... | [
"public",
"Object",
"extractFieldValue",
"(",
"final",
"Object",
"instance",
",",
"final",
"Field",
"field",
")",
"{",
"JBBPUtils",
".",
"assertNotNull",
"(",
"field",
",",
"\"Field must not be null\"",
")",
";",
"try",
"{",
"return",
"ReflectUtils",
".",
"makeA... | Auxiliary method to extract field value.
@param instance object instance, can be null
@param field the filed which value should be extracted, must not be null
@return the field value | [
"Auxiliary",
"method",
"to",
"extract",
"field",
"value",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriterExtraAdapter.java#L97-L104 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/instantiators/JBBPClassInstantiatorFactory.java | JBBPClassInstantiatorFactory.make | public JBBPClassInstantiator make(final JBBPClassInstantiatorType type) {
JBBPUtils.assertNotNull(type, "Type must not be null");
String className = "com.igormaznitsa.jbbp.mapper.instantiators.JBBPSafeInstantiator";
switch (type) {
case AUTO: {
final String customClassName = JBBPSystemProper... | java | public JBBPClassInstantiator make(final JBBPClassInstantiatorType type) {
JBBPUtils.assertNotNull(type, "Type must not be null");
String className = "com.igormaznitsa.jbbp.mapper.instantiators.JBBPSafeInstantiator";
switch (type) {
case AUTO: {
final String customClassName = JBBPSystemProper... | [
"public",
"JBBPClassInstantiator",
"make",
"(",
"final",
"JBBPClassInstantiatorType",
"type",
")",
"{",
"JBBPUtils",
".",
"assertNotNull",
"(",
"type",
",",
"\"Type must not be null\"",
")",
";",
"String",
"className",
"=",
"\"com.igormaznitsa.jbbp.mapper.instantiators.JBBP... | Make an instantiator for defined type.
@param type the type of needed instantiator, must not be null
@return the class instantiator INSTANCE which is compatible with the
current platform | [
"Make",
"an",
"instantiator",
"for",
"defined",
"type",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/instantiators/JBBPClassInstantiatorFactory.java#L71-L105 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java | JBBPBitOutputStream.writeShort | public void writeShort(final int value, final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
this.write(value >>> 8);
this.write(value);
} else {
this.write(value);
this.write(value >>> 8);
}
} | java | public void writeShort(final int value, final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
this.write(value >>> 8);
this.write(value);
} else {
this.write(value);
this.write(value >>> 8);
}
} | [
"public",
"void",
"writeShort",
"(",
"final",
"int",
"value",
",",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"if",
"(",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"BIG_ENDIAN",
")",
"{",
"this",
".",
"write",
"(",
"value",
">>>"... | Write a signed short value into the output stream.
@param value a value to be written. Only two bytes will be written.
@param byteOrder the byte order of the value bytes to be used for writing.
@throws IOException it will be thrown for transport errors
@see JBBPByteOrder#BIG_ENDIAN
@see JBBPByteOrder#LITTLE_ENDIAN | [
"Write",
"a",
"signed",
"short",
"value",
"into",
"the",
"output",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java#L92-L100 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java | JBBPBitOutputStream.writeInt | public void writeInt(final int value, final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
this.writeShort(value >>> 16, byteOrder);
this.writeShort(value, byteOrder);
} else {
this.writeShort(value, byteOrder);
this.writeShort(value >>> 16, by... | java | public void writeInt(final int value, final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
this.writeShort(value >>> 16, byteOrder);
this.writeShort(value, byteOrder);
} else {
this.writeShort(value, byteOrder);
this.writeShort(value >>> 16, by... | [
"public",
"void",
"writeInt",
"(",
"final",
"int",
"value",
",",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"if",
"(",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"BIG_ENDIAN",
")",
"{",
"this",
".",
"writeShort",
"(",
"value",
">... | Write an integer value into the output stream.
@param value a value to be written into the output stream.
@param byteOrder the byte order of the value bytes to be used for writing.
@throws IOException it will be thrown for transport errors
@see JBBPByteOrder#BIG_ENDIAN
@see JBBPByteOrder#LITTLE_ENDIAN | [
"Write",
"an",
"integer",
"value",
"into",
"the",
"output",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java#L111-L119 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java | JBBPBitOutputStream.writeFloat | public void writeFloat(final float value, final JBBPByteOrder byteOrder) throws IOException {
final int intValue = Float.floatToIntBits(value);
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
this.writeShort(intValue >>> 16, byteOrder);
this.writeShort(intValue, byteOrder);
} else {
this.writ... | java | public void writeFloat(final float value, final JBBPByteOrder byteOrder) throws IOException {
final int intValue = Float.floatToIntBits(value);
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
this.writeShort(intValue >>> 16, byteOrder);
this.writeShort(intValue, byteOrder);
} else {
this.writ... | [
"public",
"void",
"writeFloat",
"(",
"final",
"float",
"value",
",",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"final",
"int",
"intValue",
"=",
"Float",
".",
"floatToIntBits",
"(",
"value",
")",
";",
"if",
"(",
"byteOrder",
"=... | Write an float value into the output stream.
@param value a value to be written into the output stream.
@param byteOrder the byte order of the value bytes to be used for writing.
@throws IOException it will be thrown for transport errors
@see JBBPByteOrder#BIG_ENDIAN
@see JBBPByteOrder#LITTLE_ENDIAN
@since 1.4.0 | [
"Write",
"an",
"float",
"value",
"into",
"the",
"output",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java#L131-L140 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java | JBBPBitOutputStream.writeLong | public void writeLong(final long value, final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
this.writeInt((int) (value >>> 32), byteOrder);
this.writeInt((int) value, byteOrder);
} else {
this.writeInt((int) value, byteOrder);
this.writeInt((i... | java | public void writeLong(final long value, final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
this.writeInt((int) (value >>> 32), byteOrder);
this.writeInt((int) value, byteOrder);
} else {
this.writeInt((int) value, byteOrder);
this.writeInt((i... | [
"public",
"void",
"writeLong",
"(",
"final",
"long",
"value",
",",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"if",
"(",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"BIG_ENDIAN",
")",
"{",
"this",
".",
"writeInt",
"(",
"(",
"int",... | Write a long value into the output stream.
@param value a value to be written into the output stream.
@param byteOrder the byte order of the value bytes to be used for writing.
@throws IOException it will be thrown for transport errors
@see JBBPByteOrder#BIG_ENDIAN
@see JBBPByteOrder#LITTLE_ENDIAN | [
"Write",
"a",
"long",
"value",
"into",
"the",
"output",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java#L151-L159 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java | JBBPBitOutputStream.writeDouble | public void writeDouble(final double value, final JBBPByteOrder byteOrder) throws IOException {
final long longValue = Double.doubleToLongBits(value);
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
this.writeInt((int) (longValue >>> 32), byteOrder);
this.writeInt((int) longValue, byteOrder);
} els... | java | public void writeDouble(final double value, final JBBPByteOrder byteOrder) throws IOException {
final long longValue = Double.doubleToLongBits(value);
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
this.writeInt((int) (longValue >>> 32), byteOrder);
this.writeInt((int) longValue, byteOrder);
} els... | [
"public",
"void",
"writeDouble",
"(",
"final",
"double",
"value",
",",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"final",
"long",
"longValue",
"=",
"Double",
".",
"doubleToLongBits",
"(",
"value",
")",
";",
"if",
"(",
"byteOrder... | Write a double value into the output stream.
@param value a value to be written into the output stream.
@param byteOrder the byte order of the value bytes to be used for writing.
@throws IOException it will be thrown for transport errors
@see JBBPByteOrder#BIG_ENDIAN
@see JBBPByteOrder#LITTLE_ENDIAN
@since 1.4.0 | [
"Write",
"a",
"double",
"value",
"into",
"the",
"output",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java#L171-L180 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java | JBBPBitOutputStream.writeBits | public void writeBits(final int value, final JBBPBitNumber bitNumber) throws IOException {
if (this.bitBufferCount == 0 && bitNumber == JBBPBitNumber.BITS_8) {
write(value);
} else {
final int initialMask;
int mask;
initialMask = 1;
mask = initialMask << this.bitBufferCount;
... | java | public void writeBits(final int value, final JBBPBitNumber bitNumber) throws IOException {
if (this.bitBufferCount == 0 && bitNumber == JBBPBitNumber.BITS_8) {
write(value);
} else {
final int initialMask;
int mask;
initialMask = 1;
mask = initialMask << this.bitBufferCount;
... | [
"public",
"void",
"writeBits",
"(",
"final",
"int",
"value",
",",
"final",
"JBBPBitNumber",
"bitNumber",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"bitBufferCount",
"==",
"0",
"&&",
"bitNumber",
"==",
"JBBPBitNumber",
".",
"BITS_8",
")",
"{"... | Write bits into the output stream.
@param value the value which bits will be written in the output stream
@param bitNumber number of bits from the value to be written, must be in 1..8
@throws IOException it will be thrown for transport errors
@throws IllegalArgumentException it will be thrown for wron... | [
"Write",
"bits",
"into",
"the",
"output",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java#L260-L288 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java | JBBPBitOutputStream.align | public void align(final long alignByteNumber) throws IOException {
if (this.bitBufferCount > 0) {
this.writeBits(0, JBBPBitNumber.decode(8 - this.bitBufferCount));
}
if (alignByteNumber > 0) {
long padding = (alignByteNumber - (this.byteCounter % alignByteNumber)) % alignByteNumber;
while... | java | public void align(final long alignByteNumber) throws IOException {
if (this.bitBufferCount > 0) {
this.writeBits(0, JBBPBitNumber.decode(8 - this.bitBufferCount));
}
if (alignByteNumber > 0) {
long padding = (alignByteNumber - (this.byteCounter % alignByteNumber)) % alignByteNumber;
while... | [
"public",
"void",
"align",
"(",
"final",
"long",
"alignByteNumber",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"bitBufferCount",
">",
"0",
")",
"{",
"this",
".",
"writeBits",
"(",
"0",
",",
"JBBPBitNumber",
".",
"decode",
"(",
"8",
"-",
... | Write padding bytes to align the stream counter for the border.
@param alignByteNumber the alignment border
@throws IOException it will be thrown for transport errors | [
"Write",
"padding",
"bytes",
"to",
"align",
"the",
"stream",
"counter",
"for",
"the",
"border",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java#L296-L309 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java | JBBPBitOutputStream.writeByte | private void writeByte(int value) throws IOException {
if (this.msb0) {
value = JBBPUtils.reverseBitsInByte((byte) value) & 0xFF;
}
this.out.write(value);
this.byteCounter++;
} | java | private void writeByte(int value) throws IOException {
if (this.msb0) {
value = JBBPUtils.reverseBitsInByte((byte) value) & 0xFF;
}
this.out.write(value);
this.byteCounter++;
} | [
"private",
"void",
"writeByte",
"(",
"int",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"msb0",
")",
"{",
"value",
"=",
"JBBPUtils",
".",
"reverseBitsInByte",
"(",
"(",
"byte",
")",
"value",
")",
"&",
"0xFF",
";",
"}",
"this",
... | Inside method to write a byte into wrapped stream.
@param value a byte value to be written
@throws IOException it will be thrown for transport problems | [
"Inside",
"method",
"to",
"write",
"a",
"byte",
"into",
"wrapped",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java#L317-L323 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java | JBBPBitOutputStream.writeBytes | public void writeBytes(final byte[] array, final int length, final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
int i = length < 0 ? array.length - 1 : length - 1;
while (i >= 0) {
this.write(array[i--]);
}
} else {
this.write(arra... | java | public void writeBytes(final byte[] array, final int length, final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
int i = length < 0 ? array.length - 1 : length - 1;
while (i >= 0) {
this.write(array[i--]);
}
} else {
this.write(arra... | [
"public",
"void",
"writeBytes",
"(",
"final",
"byte",
"[",
"]",
"array",
",",
"final",
"int",
"length",
",",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"if",
"(",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"LITTLE_ENDIAN",
")",
"... | Write number of items from byte array into stream
@param array array, must not be null
@param length number of items to be written, if -1 then whole array
@param byteOrder order of bytes, if LITTLE_ENDIAN then array will be reversed
@throws IOException it will be thrown if any transport error
@see JBBPByteOrder... | [
"Write",
"number",
"of",
"items",
"from",
"byte",
"array",
"into",
"stream"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java#L350-L359 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/model/JBBPFieldStruct.java | JBBPFieldStruct.mapTo | public Object mapTo(final Object objectToMap, final JBBPMapperCustomFieldProcessor customFieldProcessor) {
return JBBPMapper.map(this, objectToMap, customFieldProcessor);
} | java | public Object mapTo(final Object objectToMap, final JBBPMapperCustomFieldProcessor customFieldProcessor) {
return JBBPMapper.map(this, objectToMap, customFieldProcessor);
} | [
"public",
"Object",
"mapTo",
"(",
"final",
"Object",
"objectToMap",
",",
"final",
"JBBPMapperCustomFieldProcessor",
"customFieldProcessor",
")",
"{",
"return",
"JBBPMapper",
".",
"map",
"(",
"this",
",",
"objectToMap",
",",
"customFieldProcessor",
")",
";",
"}"
] | Map the structure fields to object fields.
@param objectToMap an object to map fields of the structure, must not be
null
@param customFieldProcessor a custom field processor to provide values for
custom mapping fields, it can be null if there is not any custom field
@return the same object from the arguments ... | [
"Map",
"the",
"structure",
"fields",
"to",
"object",
"fields",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/model/JBBPFieldStruct.java#L378-L380 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/tokenizer/JBBPFieldTypeParameterContainer.java | JBBPFieldTypeParameterContainer.getExtraDataExpression | public String getExtraDataExpression() {
String result = null;
if (hasExpressionAsExtraData()) {
result = this.extraData.substring(1, this.extraData.length() - 1);
}
return result;
} | java | public String getExtraDataExpression() {
String result = null;
if (hasExpressionAsExtraData()) {
result = this.extraData.substring(1, this.extraData.length() - 1);
}
return result;
} | [
"public",
"String",
"getExtraDataExpression",
"(",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"hasExpressionAsExtraData",
"(",
")",
")",
"{",
"result",
"=",
"this",
".",
"extraData",
".",
"substring",
"(",
"1",
",",
"this",
".",
"extraData"... | Extract expression for extra data.
@return extracted expression from extra data, null if it is not extra data | [
"Extract",
"expression",
"for",
"extra",
"data",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/tokenizer/JBBPFieldTypeParameterContainer.java#L93-L99 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPNamedNumericFieldMap.java | JBBPNamedNumericFieldMap.putField | public void putField(final JBBPNumericField field) {
JBBPUtils.assertNotNull(field, "Field must not be null");
final JBBPNamedFieldInfo fieldName = field.getNameInfo();
JBBPUtils.assertNotNull(fieldName, "Field name info must not be null");
this.fieldMap.put(fieldName, field);
} | java | public void putField(final JBBPNumericField field) {
JBBPUtils.assertNotNull(field, "Field must not be null");
final JBBPNamedFieldInfo fieldName = field.getNameInfo();
JBBPUtils.assertNotNull(fieldName, "Field name info must not be null");
this.fieldMap.put(fieldName, field);
} | [
"public",
"void",
"putField",
"(",
"final",
"JBBPNumericField",
"field",
")",
"{",
"JBBPUtils",
".",
"assertNotNull",
"(",
"field",
",",
"\"Field must not be null\"",
")",
";",
"final",
"JBBPNamedFieldInfo",
"fieldName",
"=",
"field",
".",
"getNameInfo",
"(",
")",... | Put a numeric field into map.
@param field a field to be added into map or replace already exists one, it
must not be null
@throws NullPointerException if the field is null or if it is an anonymous
field | [
"Put",
"a",
"numeric",
"field",
"into",
"map",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPNamedNumericFieldMap.java#L93-L98 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPNamedNumericFieldMap.java | JBBPNamedNumericFieldMap.remove | public JBBPNumericField remove(final JBBPNamedFieldInfo nameInfo) {
JBBPUtils.assertNotNull(nameInfo, "Name info must not be null");
return this.fieldMap.remove(nameInfo);
} | java | public JBBPNumericField remove(final JBBPNamedFieldInfo nameInfo) {
JBBPUtils.assertNotNull(nameInfo, "Name info must not be null");
return this.fieldMap.remove(nameInfo);
} | [
"public",
"JBBPNumericField",
"remove",
"(",
"final",
"JBBPNamedFieldInfo",
"nameInfo",
")",
"{",
"JBBPUtils",
".",
"assertNotNull",
"(",
"nameInfo",
",",
"\"Name info must not be null\"",
")",
";",
"return",
"this",
".",
"fieldMap",
".",
"remove",
"(",
"nameInfo",
... | Remove a field for its field name info descriptor.
@param nameInfo the field name info, it must not be null
@return removed numeric field or null if there was not any field for the info | [
"Remove",
"a",
"field",
"for",
"its",
"field",
"name",
"info",
"descriptor",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPNamedNumericFieldMap.java#L106-L109 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPNamedNumericFieldMap.java | JBBPNamedNumericFieldMap.findForFieldOffset | public JBBPNumericField findForFieldOffset(final int offset) {
JBBPNumericField result = null;
for (final Map.Entry<JBBPNamedFieldInfo, JBBPNumericField> f : fieldMap.entrySet()) {
if (f.getKey().getFieldOffsetInCompiledBlock() == offset) {
result = f.getValue();
break;
}
}
r... | java | public JBBPNumericField findForFieldOffset(final int offset) {
JBBPNumericField result = null;
for (final Map.Entry<JBBPNamedFieldInfo, JBBPNumericField> f : fieldMap.entrySet()) {
if (f.getKey().getFieldOffsetInCompiledBlock() == offset) {
result = f.getValue();
break;
}
}
r... | [
"public",
"JBBPNumericField",
"findForFieldOffset",
"(",
"final",
"int",
"offset",
")",
"{",
"JBBPNumericField",
"result",
"=",
"null",
";",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"JBBPNamedFieldInfo",
",",
"JBBPNumericField",
">",
"f",
":",
"fieldMap",
... | Find a registered field for its field offset in compiled script.
@param offset the field offset
@return found field or null if there is not any found for the offset | [
"Find",
"a",
"registered",
"field",
"for",
"its",
"field",
"offset",
"in",
"compiled",
"script",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPNamedNumericFieldMap.java#L117-L126 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPNamedNumericFieldMap.java | JBBPNamedNumericFieldMap.getExternalFieldValue | public int getExternalFieldValue(final String externalFieldName, final JBBPCompiledBlock compiledBlock, final JBBPIntegerValueEvaluator evaluator) {
final String normalizedName = JBBPUtils.normalizeFieldNameOrPath(externalFieldName);
if (this.externalValueProvider == null) {
throw new JBBPEvalException("R... | java | public int getExternalFieldValue(final String externalFieldName, final JBBPCompiledBlock compiledBlock, final JBBPIntegerValueEvaluator evaluator) {
final String normalizedName = JBBPUtils.normalizeFieldNameOrPath(externalFieldName);
if (this.externalValueProvider == null) {
throw new JBBPEvalException("R... | [
"public",
"int",
"getExternalFieldValue",
"(",
"final",
"String",
"externalFieldName",
",",
"final",
"JBBPCompiledBlock",
"compiledBlock",
",",
"final",
"JBBPIntegerValueEvaluator",
"evaluator",
")",
"{",
"final",
"String",
"normalizedName",
"=",
"JBBPUtils",
".",
"norm... | Ask the registered external value provider for a field value.
@param externalFieldName the name of a field, it must not be null
@param compiledBlock the compiled block, it must not be null
@param evaluator an evaluator which is calling the method, it can be null
@return integer value for the field
@throws ... | [
"Ask",
"the",
"registered",
"external",
"value",
"provider",
"for",
"a",
"field",
"value",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/JBBPNamedNumericFieldMap.java#L296-L303 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/AbstractMappedClassFieldObserver.java | AbstractMappedClassFieldObserver.readFieldValue | private static Object readFieldValue(final Object obj, final Field field) {
try {
return field.get(obj);
} catch (Exception ex) {
throw new JBBPException("Can't get value from field [" + field + ']', ex);
}
} | java | private static Object readFieldValue(final Object obj, final Field field) {
try {
return field.get(obj);
} catch (Exception ex) {
throw new JBBPException("Can't get value from field [" + field + ']', ex);
}
} | [
"private",
"static",
"Object",
"readFieldValue",
"(",
"final",
"Object",
"obj",
",",
"final",
"Field",
"field",
")",
"{",
"try",
"{",
"return",
"field",
".",
"get",
"(",
"obj",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
... | Inside auxiliary method to read object field value.
@param obj an object which field is read
@param field a field to be read
@return a value from the field of the object
@throws JBBPException if the field can't be read
@since 1.1 | [
"Inside",
"auxiliary",
"method",
"to",
"read",
"object",
"field",
"value",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/AbstractMappedClassFieldObserver.java#L61-L67 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/AbstractMappedClassFieldObserver.java | AbstractMappedClassFieldObserver.onFieldCustom | protected void onFieldCustom(final Object obj, final Field field, final Bin annotation, final Object customFieldProcessor, final Object value) {
} | java | protected void onFieldCustom(final Object obj, final Field field, final Bin annotation, final Object customFieldProcessor, final Object value) {
} | [
"protected",
"void",
"onFieldCustom",
"(",
"final",
"Object",
"obj",
",",
"final",
"Field",
"field",
",",
"final",
"Bin",
"annotation",
",",
"final",
"Object",
"customFieldProcessor",
",",
"final",
"Object",
"value",
")",
"{",
"}"
] | Notification about custom field.
@param obj the object instance, must not be null
@param field the custom field, must not be null
@param annotation the annotation for the field, must not be null
@param customFieldProcessor processor for custom fields, must not be null
@param v... | [
"Notification",
"about",
"custom",
"field",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/AbstractMappedClassFieldObserver.java#L527-L529 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/AbstractMappedClassFieldObserver.java | AbstractMappedClassFieldObserver.onFieldBits | protected void onFieldBits(final Object obj, final Field field, final Bin annotation, final JBBPBitNumber bitNumber, final int value) {
} | java | protected void onFieldBits(final Object obj, final Field field, final Bin annotation, final JBBPBitNumber bitNumber, final int value) {
} | [
"protected",
"void",
"onFieldBits",
"(",
"final",
"Object",
"obj",
",",
"final",
"Field",
"field",
",",
"final",
"Bin",
"annotation",
",",
"final",
"JBBPBitNumber",
"bitNumber",
",",
"final",
"int",
"value",
")",
"{",
"}"
] | Notification about bit field.
@param obj the object instance, must not be null
@param field the field, must not be null
@param annotation the annotation for field, must not be null
@param bitNumber number of bits for the field, must not be null
@param value the value of the field | [
"Notification",
"about",
"bit",
"field",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/AbstractMappedClassFieldObserver.java#L540-L542 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/AbstractMappedClassFieldObserver.java | AbstractMappedClassFieldObserver.resetInsideClassCache | public void resetInsideClassCache() {
final Map<Class<?>, Field[]> fieldz = cachedClasses;
if (fieldz != null) {
synchronized (fieldz) {
fieldz.clear();
}
}
} | java | public void resetInsideClassCache() {
final Map<Class<?>, Field[]> fieldz = cachedClasses;
if (fieldz != null) {
synchronized (fieldz) {
fieldz.clear();
}
}
} | [
"public",
"void",
"resetInsideClassCache",
"(",
")",
"{",
"final",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"Field",
"[",
"]",
">",
"fieldz",
"=",
"cachedClasses",
";",
"if",
"(",
"fieldz",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"fieldz",
")",
... | Inside JBBPOut.Bin command creates cached list of fields of a saved class,
the method allows to reset the inside cache. | [
"Inside",
"JBBPOut",
".",
"Bin",
"command",
"creates",
"cached",
"list",
"of",
"fields",
"of",
"a",
"saved",
"class",
"the",
"method",
"allows",
"to",
"reset",
"the",
"inside",
"cache",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/AbstractMappedClassFieldObserver.java#L694-L701 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.makeStrWriter | public static JBBPTextWriter makeStrWriter() {
final String lineSeparator = System.setProperty("line.separator", "\n");
return new JBBPTextWriter(new StringWriter(), JBBPByteOrder.BIG_ENDIAN, lineSeparator, 16, "0x", ".", ";", "~", ",");
} | java | public static JBBPTextWriter makeStrWriter() {
final String lineSeparator = System.setProperty("line.separator", "\n");
return new JBBPTextWriter(new StringWriter(), JBBPByteOrder.BIG_ENDIAN, lineSeparator, 16, "0x", ".", ";", "~", ",");
} | [
"public",
"static",
"JBBPTextWriter",
"makeStrWriter",
"(",
")",
"{",
"final",
"String",
"lineSeparator",
"=",
"System",
".",
"setProperty",
"(",
"\"line.separator\"",
",",
"\"\\n\"",
")",
";",
"return",
"new",
"JBBPTextWriter",
"(",
"new",
"StringWriter",
"(",
... | Auxiliary method allows to build writer over StringWriter with system-depended next line and hex radix.
The Method allows fast instance create.
@since 1.4.0 | [
"Auxiliary",
"method",
"allows",
"to",
"build",
"writer",
"over",
"StringWriter",
"with",
"system",
"-",
"depended",
"next",
"line",
"and",
"hex",
"radix",
".",
"The",
"Method",
"allows",
"fast",
"instance",
"create",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L331-L334 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.ensureValueMode | private void ensureValueMode() throws IOException {
switch (this.mode) {
case MODE_START_LINE: {
changeMode(MODE_VALUES);
for (final Extra e : extras) {
e.onBeforeFirstValue(this);
}
writeIndent();
this.write(this.prefixFirtValueAtLine);
}
break;
... | java | private void ensureValueMode() throws IOException {
switch (this.mode) {
case MODE_START_LINE: {
changeMode(MODE_VALUES);
for (final Extra e : extras) {
e.onBeforeFirstValue(this);
}
writeIndent();
this.write(this.prefixFirtValueAtLine);
}
break;
... | [
"private",
"void",
"ensureValueMode",
"(",
")",
"throws",
"IOException",
"{",
"switch",
"(",
"this",
".",
"mode",
")",
"{",
"case",
"MODE_START_LINE",
":",
"{",
"changeMode",
"(",
"MODE_VALUES",
")",
";",
"for",
"(",
"final",
"Extra",
"e",
":",
"extras",
... | Ensure the value mode.
@throws IOException it will be thrown for transport errors | [
"Ensure",
"the",
"value",
"mode",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L399-L425 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.ensureCommentMode | private void ensureCommentMode() throws IOException {
switch (this.mode) {
case MODE_START_LINE:
writeIndent();
this.prevLineCommentsStartPosition = this.linePosition;
this.write(this.prefixComment);
changeMode(MODE_COMMENTS);
break;
case MODE_VALUES: {
th... | java | private void ensureCommentMode() throws IOException {
switch (this.mode) {
case MODE_START_LINE:
writeIndent();
this.prevLineCommentsStartPosition = this.linePosition;
this.write(this.prefixComment);
changeMode(MODE_COMMENTS);
break;
case MODE_VALUES: {
th... | [
"private",
"void",
"ensureCommentMode",
"(",
")",
"throws",
"IOException",
"{",
"switch",
"(",
"this",
".",
"mode",
")",
"{",
"case",
"MODE_START_LINE",
":",
"writeIndent",
"(",
")",
";",
"this",
".",
"prevLineCommentsStartPosition",
"=",
"this",
".",
"linePos... | Ensure the comment mode.
@throws IOException it will be thrown for transport errors | [
"Ensure",
"the",
"comment",
"mode",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L447-L473 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.printValueString | private void printValueString(final String value) throws IOException {
if (this.valuesLineCounter > 0 && this.valueSeparator.length() > 0) {
this.write(this.valueSeparator);
}
if (this.prefixValue.length() > 0) {
this.write(this.prefixValue);
}
this.write(value);
if (this.postfixV... | java | private void printValueString(final String value) throws IOException {
if (this.valuesLineCounter > 0 && this.valueSeparator.length() > 0) {
this.write(this.valueSeparator);
}
if (this.prefixValue.length() > 0) {
this.write(this.prefixValue);
}
this.write(value);
if (this.postfixV... | [
"private",
"void",
"printValueString",
"(",
"final",
"String",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"valuesLineCounter",
">",
"0",
"&&",
"this",
".",
"valueSeparator",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"this",
".... | Print a value represented by its string.
@param value the value to be printed, must not be null
@throws IOException it will be thrown for transport errors | [
"Print",
"a",
"value",
"represented",
"by",
"its",
"string",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L494-L516 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Str | public JBBPTextWriter Str(final String... str) throws IOException {
JBBPUtils.assertNotNull(str, "String must not be null");
final String oldPrefix = this.prefixValue;
final String oldPostfix = this.postfixValue;
this.prefixValue = "";
this.postfixValue = "";
for (final String s : str) {
... | java | public JBBPTextWriter Str(final String... str) throws IOException {
JBBPUtils.assertNotNull(str, "String must not be null");
final String oldPrefix = this.prefixValue;
final String oldPostfix = this.postfixValue;
this.prefixValue = "";
this.postfixValue = "";
for (final String s : str) {
... | [
"public",
"JBBPTextWriter",
"Str",
"(",
"final",
"String",
"...",
"str",
")",
"throws",
"IOException",
"{",
"JBBPUtils",
".",
"assertNotNull",
"(",
"str",
",",
"\"String must not be null\"",
")",
";",
"final",
"String",
"oldPrefix",
"=",
"this",
".",
"prefixValu... | Print string values.
@param str array of string values, must not be null but may contain nulls
@return the context
@throws IOException it will be thrown for error | [
"Print",
"string",
"values",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L545-L561 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.