id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
141,900 | 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.postfixValue.length() > 0) {
this.write(this.postfixValue);
}
this.valuesLineCounter++;
if (this.maxValuesPerLine > 0 && this.valuesLineCounter >= this.maxValuesPerLine) {
for (final Extra e : this.extras) {
e.onReachedMaxValueNumberForLine(this);
}
ensureNewLineMode();
}
} | 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.postfixValue.length() > 0) {
this.write(this.postfixValue);
}
this.valuesLineCounter++;
if (this.maxValuesPerLine > 0 && this.valuesLineCounter >= this.maxValuesPerLine) {
for (final Extra e : this.extras) {
e.onReachedMaxValueNumberForLine(this);
}
ensureNewLineMode();
}
} | [
"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",
".",
"postfixValue",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"this",
".",
"write",
"(",
"this",
".",
"postfixValue",
")",
";",
"}",
"this",
".",
"valuesLineCounter",
"++",
";",
"if",
"(",
"this",
".",
"maxValuesPerLine",
">",
"0",
"&&",
"this",
".",
"valuesLineCounter",
">=",
"this",
".",
"maxValuesPerLine",
")",
"{",
"for",
"(",
"final",
"Extra",
"e",
":",
"this",
".",
"extras",
")",
"{",
"e",
".",
"onReachedMaxValueNumberForLine",
"(",
"this",
")",
";",
"}",
"ensureNewLineMode",
"(",
")",
";",
"}",
"}"
] | 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 |
141,901 | 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) {
ensureValueMode();
printValueString(s == null ? "<NULL>" : s);
}
this.prefixValue = oldPrefix;
this.postfixValue = oldPostfix;
return this;
} | 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) {
ensureValueMode();
printValueString(s == null ? "<NULL>" : s);
}
this.prefixValue = oldPrefix;
this.postfixValue = oldPostfix;
return this;
} | [
"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",
")",
"{",
"ensureValueMode",
"(",
")",
";",
"printValueString",
"(",
"s",
"==",
"null",
"?",
"\"<NULL>\"",
":",
"s",
")",
";",
"}",
"this",
".",
"prefixValue",
"=",
"oldPrefix",
";",
"this",
".",
"postfixValue",
"=",
"oldPostfix",
";",
"return",
"this",
";",
"}"
] | 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 |
141,902 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Byte | public JBBPTextWriter Byte(final int value) throws IOException {
ensureValueMode();
String convertedByExtras = null;
for (final Extra e : this.extras) {
convertedByExtras = e.doConvertByteToStr(this, value & 0xFF);
if (convertedByExtras != null) {
break;
}
}
if (convertedByExtras == null) {
printValueString(JBBPUtils.ensureMinTextLength(JBBPUtils.ulong2str(value & 0xFF, this.radix, CHAR_BUFFER), this.maxCharsRadixForByte, '0', 0));
} else {
printValueString(convertedByExtras);
}
return this;
} | java | public JBBPTextWriter Byte(final int value) throws IOException {
ensureValueMode();
String convertedByExtras = null;
for (final Extra e : this.extras) {
convertedByExtras = e.doConvertByteToStr(this, value & 0xFF);
if (convertedByExtras != null) {
break;
}
}
if (convertedByExtras == null) {
printValueString(JBBPUtils.ensureMinTextLength(JBBPUtils.ulong2str(value & 0xFF, this.radix, CHAR_BUFFER), this.maxCharsRadixForByte, '0', 0));
} else {
printValueString(convertedByExtras);
}
return this;
} | [
"public",
"JBBPTextWriter",
"Byte",
"(",
"final",
"int",
"value",
")",
"throws",
"IOException",
"{",
"ensureValueMode",
"(",
")",
";",
"String",
"convertedByExtras",
"=",
"null",
";",
"for",
"(",
"final",
"Extra",
"e",
":",
"this",
".",
"extras",
")",
"{",
"convertedByExtras",
"=",
"e",
".",
"doConvertByteToStr",
"(",
"this",
",",
"value",
"&",
"0xFF",
")",
";",
"if",
"(",
"convertedByExtras",
"!=",
"null",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"convertedByExtras",
"==",
"null",
")",
"{",
"printValueString",
"(",
"JBBPUtils",
".",
"ensureMinTextLength",
"(",
"JBBPUtils",
".",
"ulong2str",
"(",
"value",
"&",
"0xFF",
",",
"this",
".",
"radix",
",",
"CHAR_BUFFER",
")",
",",
"this",
".",
"maxCharsRadixForByte",
",",
"'",
"'",
",",
"0",
")",
")",
";",
"}",
"else",
"{",
"printValueString",
"(",
"convertedByExtras",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print byte value.
@param value a byte value
@return the context
@throws IOException it will be thrown for transport errors | [
"Print",
"byte",
"value",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L570-L588 |
141,903 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Byte | public JBBPTextWriter Byte(final String value) throws IOException {
for (int i = 0; i < value.length(); i++) {
this.Byte(value.charAt(i));
}
return this;
} | java | public JBBPTextWriter Byte(final String value) throws IOException {
for (int i = 0; i < value.length(); i++) {
this.Byte(value.charAt(i));
}
return this;
} | [
"public",
"JBBPTextWriter",
"Byte",
"(",
"final",
"String",
"value",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"value",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"this",
".",
"Byte",
"(",
"value",
".",
"charAt",
"(",
"i",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print byte array defined as string.
@param value string which codes should be printed as byte array.
@return the context
@throws IOException it will be thrown for transport error | [
"Print",
"byte",
"array",
"defined",
"as",
"string",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L597-L602 |
141,904 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Byte | public JBBPTextWriter Byte(final byte[] array, int off, int len) throws IOException {
ensureValueMode();
while (len-- > 0) {
Byte(array[off++]);
}
return this;
} | java | public JBBPTextWriter Byte(final byte[] array, int off, int len) throws IOException {
ensureValueMode();
while (len-- > 0) {
Byte(array[off++]);
}
return this;
} | [
"public",
"JBBPTextWriter",
"Byte",
"(",
"final",
"byte",
"[",
"]",
"array",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"ensureValueMode",
"(",
")",
";",
"while",
"(",
"len",
"--",
">",
"0",
")",
"{",
"Byte",
"(",
"array",
"[",
"off",
"++",
"]",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print values from byte array.
@param array source byte array, must not be null
@param off the offset of the first element in array
@param len number of bytes to be printed
@return the context
@throws IOException it will be thrown for transport errors | [
"Print",
"values",
"from",
"byte",
"array",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L624-L631 |
141,905 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.AddExtras | public JBBPTextWriter AddExtras(final Extra... extras) {
JBBPUtils.assertNotNull(extras, "Extras must not be null");
for (final Extra e : extras) {
JBBPUtils.assertNotNull(e, "Extras must not be null");
this.extras.add(0, e);
}
return this;
} | java | public JBBPTextWriter AddExtras(final Extra... extras) {
JBBPUtils.assertNotNull(extras, "Extras must not be null");
for (final Extra e : extras) {
JBBPUtils.assertNotNull(e, "Extras must not be null");
this.extras.add(0, e);
}
return this;
} | [
"public",
"JBBPTextWriter",
"AddExtras",
"(",
"final",
"Extra",
"...",
"extras",
")",
"{",
"JBBPUtils",
".",
"assertNotNull",
"(",
"extras",
",",
"\"Extras must not be null\"",
")",
";",
"for",
"(",
"final",
"Extra",
"e",
":",
"extras",
")",
"{",
"JBBPUtils",
".",
"assertNotNull",
"(",
"e",
",",
"\"Extras must not be null\"",
")",
";",
"this",
".",
"extras",
".",
"add",
"(",
"0",
",",
"e",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Add extras to context.
@param extras extras to be added to context, must not be null
@return the context | [
"Add",
"extras",
"to",
"context",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L721-L728 |
141,906 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.DelExtras | public JBBPTextWriter DelExtras(final Extra... extras) {
JBBPUtils.assertNotNull(extras, "Extras must not be null");
for (final Extra e : extras) {
JBBPUtils.assertNotNull(e, "Extras must not be null");
this.extras.remove(e);
}
return this;
} | java | public JBBPTextWriter DelExtras(final Extra... extras) {
JBBPUtils.assertNotNull(extras, "Extras must not be null");
for (final Extra e : extras) {
JBBPUtils.assertNotNull(e, "Extras must not be null");
this.extras.remove(e);
}
return this;
} | [
"public",
"JBBPTextWriter",
"DelExtras",
"(",
"final",
"Extra",
"...",
"extras",
")",
"{",
"JBBPUtils",
".",
"assertNotNull",
"(",
"extras",
",",
"\"Extras must not be null\"",
")",
";",
"for",
"(",
"final",
"Extra",
"e",
":",
"extras",
")",
"{",
"JBBPUtils",
".",
"assertNotNull",
"(",
"e",
",",
"\"Extras must not be null\"",
")",
";",
"this",
".",
"extras",
".",
"remove",
"(",
"e",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Remove extras from context
@param extras extras to be removed, must not be null
@return the context | [
"Remove",
"extras",
"from",
"context"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L736-L743 |
141,907 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.SetTabSpaces | public JBBPTextWriter SetTabSpaces(final int numberOfSpacesPerTab) {
if (numberOfSpacesPerTab <= 0) {
throw new IllegalArgumentException("Tab must contains positive number of space chars [" + numberOfSpacesPerTab + ']');
}
final int currentIdentSteps = this.indent / this.spacesInTab;
this.spacesInTab = numberOfSpacesPerTab;
this.indent = currentIdentSteps * this.spacesInTab;
return this;
} | java | public JBBPTextWriter SetTabSpaces(final int numberOfSpacesPerTab) {
if (numberOfSpacesPerTab <= 0) {
throw new IllegalArgumentException("Tab must contains positive number of space chars [" + numberOfSpacesPerTab + ']');
}
final int currentIdentSteps = this.indent / this.spacesInTab;
this.spacesInTab = numberOfSpacesPerTab;
this.indent = currentIdentSteps * this.spacesInTab;
return this;
} | [
"public",
"JBBPTextWriter",
"SetTabSpaces",
"(",
"final",
"int",
"numberOfSpacesPerTab",
")",
"{",
"if",
"(",
"numberOfSpacesPerTab",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Tab must contains positive number of space chars [\"",
"+",
"numberOfSpacesPerTab",
"+",
"'",
"'",
")",
";",
"}",
"final",
"int",
"currentIdentSteps",
"=",
"this",
".",
"indent",
"/",
"this",
".",
"spacesInTab",
";",
"this",
".",
"spacesInTab",
"=",
"numberOfSpacesPerTab",
";",
"this",
".",
"indent",
"=",
"currentIdentSteps",
"*",
"this",
".",
"spacesInTab",
";",
"return",
"this",
";",
"}"
] | Set number of spaces per tab.
@param numberOfSpacesPerTab number of spaces, must be greater than zero
@return the context | [
"Set",
"number",
"of",
"spaces",
"per",
"tab",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L763-L771 |
141,908 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Radix | public final JBBPTextWriter Radix(final int radix) {
if (radix < 2 || radix > 36) {
throw new IllegalArgumentException("Unsupported radix value [" + radix + ']');
}
this.radix = radix;
this.maxCharsRadixForByte = JBBPUtils.ulong2str(0xFFL, this.radix, CHAR_BUFFER).length();
this.maxCharsRadixForShort = JBBPUtils.ulong2str(0xFFFFL, this.radix, CHAR_BUFFER).length();
this.maxCharsRadixForInt = JBBPUtils.ulong2str(0xFFFFFFFFL, this.radix, CHAR_BUFFER).length();
this.maxCharsRadixForLong = JBBPUtils.ulong2str(0xFFFFFFFFFFFFFFFFL, this.radix, CHAR_BUFFER).length();
return this;
} | java | public final JBBPTextWriter Radix(final int radix) {
if (radix < 2 || radix > 36) {
throw new IllegalArgumentException("Unsupported radix value [" + radix + ']');
}
this.radix = radix;
this.maxCharsRadixForByte = JBBPUtils.ulong2str(0xFFL, this.radix, CHAR_BUFFER).length();
this.maxCharsRadixForShort = JBBPUtils.ulong2str(0xFFFFL, this.radix, CHAR_BUFFER).length();
this.maxCharsRadixForInt = JBBPUtils.ulong2str(0xFFFFFFFFL, this.radix, CHAR_BUFFER).length();
this.maxCharsRadixForLong = JBBPUtils.ulong2str(0xFFFFFFFFFFFFFFFFL, this.radix, CHAR_BUFFER).length();
return this;
} | [
"public",
"final",
"JBBPTextWriter",
"Radix",
"(",
"final",
"int",
"radix",
")",
"{",
"if",
"(",
"radix",
"<",
"2",
"||",
"radix",
">",
"36",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unsupported radix value [\"",
"+",
"radix",
"+",
"'",
"'",
")",
";",
"}",
"this",
".",
"radix",
"=",
"radix",
";",
"this",
".",
"maxCharsRadixForByte",
"=",
"JBBPUtils",
".",
"ulong2str",
"(",
"0xFF",
"L",
",",
"this",
".",
"radix",
",",
"CHAR_BUFFER",
")",
".",
"length",
"(",
")",
";",
"this",
".",
"maxCharsRadixForShort",
"=",
"JBBPUtils",
".",
"ulong2str",
"(",
"0xFFFF",
"L",
",",
"this",
".",
"radix",
",",
"CHAR_BUFFER",
")",
".",
"length",
"(",
")",
";",
"this",
".",
"maxCharsRadixForInt",
"=",
"JBBPUtils",
".",
"ulong2str",
"(",
"0xFFFFFFFF",
"L",
",",
"this",
".",
"radix",
",",
"CHAR_BUFFER",
")",
".",
"length",
"(",
")",
";",
"this",
".",
"maxCharsRadixForLong",
"=",
"JBBPUtils",
".",
"ulong2str",
"(",
"0xFFFFFFFFFFFFFFFF",
"L",
",",
"this",
".",
"radix",
",",
"CHAR_BUFFER",
")",
".",
"length",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Set radix.
@param radix new radix value, must be 2..36
@return the context | [
"Set",
"radix",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L791-L802 |
141,909 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Short | public JBBPTextWriter Short(final int value) throws IOException {
ensureValueMode();
String convertedByExtras = null;
for (final Extra e : this.extras) {
convertedByExtras = e.doConvertShortToStr(this, value & 0xFFFF);
if (convertedByExtras != null) {
break;
}
}
if (convertedByExtras == null) {
final long valueToWrite;
if (this.byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
valueToWrite = JBBPUtils.reverseByteOrder(value, 2);
} else {
valueToWrite = value;
}
printValueString(JBBPUtils.ensureMinTextLength(JBBPUtils.ulong2str(valueToWrite & 0xFFFFL, this.radix, CHAR_BUFFER), this.maxCharsRadixForShort, '0', 0));
} else {
printValueString(convertedByExtras);
}
return this;
} | java | public JBBPTextWriter Short(final int value) throws IOException {
ensureValueMode();
String convertedByExtras = null;
for (final Extra e : this.extras) {
convertedByExtras = e.doConvertShortToStr(this, value & 0xFFFF);
if (convertedByExtras != null) {
break;
}
}
if (convertedByExtras == null) {
final long valueToWrite;
if (this.byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
valueToWrite = JBBPUtils.reverseByteOrder(value, 2);
} else {
valueToWrite = value;
}
printValueString(JBBPUtils.ensureMinTextLength(JBBPUtils.ulong2str(valueToWrite & 0xFFFFL, this.radix, CHAR_BUFFER), this.maxCharsRadixForShort, '0', 0));
} else {
printValueString(convertedByExtras);
}
return this;
} | [
"public",
"JBBPTextWriter",
"Short",
"(",
"final",
"int",
"value",
")",
"throws",
"IOException",
"{",
"ensureValueMode",
"(",
")",
";",
"String",
"convertedByExtras",
"=",
"null",
";",
"for",
"(",
"final",
"Extra",
"e",
":",
"this",
".",
"extras",
")",
"{",
"convertedByExtras",
"=",
"e",
".",
"doConvertShortToStr",
"(",
"this",
",",
"value",
"&",
"0xFFFF",
")",
";",
"if",
"(",
"convertedByExtras",
"!=",
"null",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"convertedByExtras",
"==",
"null",
")",
"{",
"final",
"long",
"valueToWrite",
";",
"if",
"(",
"this",
".",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"LITTLE_ENDIAN",
")",
"{",
"valueToWrite",
"=",
"JBBPUtils",
".",
"reverseByteOrder",
"(",
"value",
",",
"2",
")",
";",
"}",
"else",
"{",
"valueToWrite",
"=",
"value",
";",
"}",
"printValueString",
"(",
"JBBPUtils",
".",
"ensureMinTextLength",
"(",
"JBBPUtils",
".",
"ulong2str",
"(",
"valueToWrite",
"&",
"0xFFFF",
"L",
",",
"this",
".",
"radix",
",",
"CHAR_BUFFER",
")",
",",
"this",
".",
"maxCharsRadixForShort",
",",
"'",
"'",
",",
"0",
")",
")",
";",
"}",
"else",
"{",
"printValueString",
"(",
"convertedByExtras",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print short value.
@param value short value to be printed
@return the context
@throws IOException it will be thrown for transport errors | [
"Print",
"short",
"value",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L811-L833 |
141,910 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Float | public JBBPTextWriter Float(final float value) throws IOException {
ensureValueMode();
String convertedByExtras = null;
for (final Extra e : this.extras) {
convertedByExtras = e.doConvertFloatToStr(this, value);
if (convertedByExtras != null) {
break;
}
}
if (convertedByExtras == null) {
final float valueToWrite;
if (this.byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
valueToWrite = Float.intBitsToFloat((int) JBBPFieldInt.reverseBits(Float.floatToIntBits(value)));
} else {
valueToWrite = value;
}
printValueString(JBBPUtils.ensureMinTextLength(JBBPUtils.float2str(valueToWrite, this.radix), this.maxCharsRadixForShort, '0', 0));
} else {
printValueString(convertedByExtras);
}
return this;
} | java | public JBBPTextWriter Float(final float value) throws IOException {
ensureValueMode();
String convertedByExtras = null;
for (final Extra e : this.extras) {
convertedByExtras = e.doConvertFloatToStr(this, value);
if (convertedByExtras != null) {
break;
}
}
if (convertedByExtras == null) {
final float valueToWrite;
if (this.byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
valueToWrite = Float.intBitsToFloat((int) JBBPFieldInt.reverseBits(Float.floatToIntBits(value)));
} else {
valueToWrite = value;
}
printValueString(JBBPUtils.ensureMinTextLength(JBBPUtils.float2str(valueToWrite, this.radix), this.maxCharsRadixForShort, '0', 0));
} else {
printValueString(convertedByExtras);
}
return this;
} | [
"public",
"JBBPTextWriter",
"Float",
"(",
"final",
"float",
"value",
")",
"throws",
"IOException",
"{",
"ensureValueMode",
"(",
")",
";",
"String",
"convertedByExtras",
"=",
"null",
";",
"for",
"(",
"final",
"Extra",
"e",
":",
"this",
".",
"extras",
")",
"{",
"convertedByExtras",
"=",
"e",
".",
"doConvertFloatToStr",
"(",
"this",
",",
"value",
")",
";",
"if",
"(",
"convertedByExtras",
"!=",
"null",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"convertedByExtras",
"==",
"null",
")",
"{",
"final",
"float",
"valueToWrite",
";",
"if",
"(",
"this",
".",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"LITTLE_ENDIAN",
")",
"{",
"valueToWrite",
"=",
"Float",
".",
"intBitsToFloat",
"(",
"(",
"int",
")",
"JBBPFieldInt",
".",
"reverseBits",
"(",
"Float",
".",
"floatToIntBits",
"(",
"value",
")",
")",
")",
";",
"}",
"else",
"{",
"valueToWrite",
"=",
"value",
";",
"}",
"printValueString",
"(",
"JBBPUtils",
".",
"ensureMinTextLength",
"(",
"JBBPUtils",
".",
"float2str",
"(",
"valueToWrite",
",",
"this",
".",
"radix",
")",
",",
"this",
".",
"maxCharsRadixForShort",
",",
"'",
"'",
",",
"0",
")",
")",
";",
"}",
"else",
"{",
"printValueString",
"(",
"convertedByExtras",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print float value.
@param value float value to be printed
@return the context
@throws IOException it will be thrown for transport errors
@since 1.4.0 | [
"Print",
"float",
"value",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L843-L865 |
141,911 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Double | public JBBPTextWriter Double(final double value) throws IOException {
ensureValueMode();
String convertedByExtras = null;
for (final Extra e : this.extras) {
convertedByExtras = e.doConvertDoubleToStr(this, value);
if (convertedByExtras != null) {
break;
}
}
if (convertedByExtras == null) {
final double valueToWrite;
if (this.byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
valueToWrite = Double.longBitsToDouble(JBBPFieldLong.reverseBits(Double.doubleToLongBits(value)));
} else {
valueToWrite = value;
}
printValueString(JBBPUtils.ensureMinTextLength(JBBPUtils.double2str(valueToWrite, this.radix), this.maxCharsRadixForShort, '0', 0));
} else {
printValueString(convertedByExtras);
}
return this;
} | java | public JBBPTextWriter Double(final double value) throws IOException {
ensureValueMode();
String convertedByExtras = null;
for (final Extra e : this.extras) {
convertedByExtras = e.doConvertDoubleToStr(this, value);
if (convertedByExtras != null) {
break;
}
}
if (convertedByExtras == null) {
final double valueToWrite;
if (this.byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
valueToWrite = Double.longBitsToDouble(JBBPFieldLong.reverseBits(Double.doubleToLongBits(value)));
} else {
valueToWrite = value;
}
printValueString(JBBPUtils.ensureMinTextLength(JBBPUtils.double2str(valueToWrite, this.radix), this.maxCharsRadixForShort, '0', 0));
} else {
printValueString(convertedByExtras);
}
return this;
} | [
"public",
"JBBPTextWriter",
"Double",
"(",
"final",
"double",
"value",
")",
"throws",
"IOException",
"{",
"ensureValueMode",
"(",
")",
";",
"String",
"convertedByExtras",
"=",
"null",
";",
"for",
"(",
"final",
"Extra",
"e",
":",
"this",
".",
"extras",
")",
"{",
"convertedByExtras",
"=",
"e",
".",
"doConvertDoubleToStr",
"(",
"this",
",",
"value",
")",
";",
"if",
"(",
"convertedByExtras",
"!=",
"null",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"convertedByExtras",
"==",
"null",
")",
"{",
"final",
"double",
"valueToWrite",
";",
"if",
"(",
"this",
".",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"LITTLE_ENDIAN",
")",
"{",
"valueToWrite",
"=",
"Double",
".",
"longBitsToDouble",
"(",
"JBBPFieldLong",
".",
"reverseBits",
"(",
"Double",
".",
"doubleToLongBits",
"(",
"value",
")",
")",
")",
";",
"}",
"else",
"{",
"valueToWrite",
"=",
"value",
";",
"}",
"printValueString",
"(",
"JBBPUtils",
".",
"ensureMinTextLength",
"(",
"JBBPUtils",
".",
"double2str",
"(",
"valueToWrite",
",",
"this",
".",
"radix",
")",
",",
"this",
".",
"maxCharsRadixForShort",
",",
"'",
"'",
",",
"0",
")",
")",
";",
"}",
"else",
"{",
"printValueString",
"(",
"convertedByExtras",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print double value.
@param value double value to be printed
@return the context
@throws IOException it will be thrown for transport errors
@since 1.4.0 | [
"Print",
"double",
"value",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L875-L897 |
141,912 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Short | public JBBPTextWriter Short(final String value) throws IOException {
for (int i = 0; i < value.length(); i++) {
this.Short(value.charAt(i));
}
return this;
} | java | public JBBPTextWriter Short(final String value) throws IOException {
for (int i = 0; i < value.length(); i++) {
this.Short(value.charAt(i));
}
return this;
} | [
"public",
"JBBPTextWriter",
"Short",
"(",
"final",
"String",
"value",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"value",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"this",
".",
"Short",
"(",
"value",
".",
"charAt",
"(",
"i",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print char codes of string as short array.
@param value string which codes should be printed, must not be null
@return the context
@throws IOException it will be thrown if any transport error | [
"Print",
"char",
"codes",
"of",
"string",
"as",
"short",
"array",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L906-L911 |
141,913 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Short | public JBBPTextWriter Short(final short[] values, int off, int len) throws IOException {
while (len-- > 0) {
this.Short(values[off++]);
}
return this;
} | java | public JBBPTextWriter Short(final short[] values, int off, int len) throws IOException {
while (len-- > 0) {
this.Short(values[off++]);
}
return this;
} | [
"public",
"JBBPTextWriter",
"Short",
"(",
"final",
"short",
"[",
"]",
"values",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"while",
"(",
"len",
"--",
">",
"0",
")",
"{",
"this",
".",
"Short",
"(",
"values",
"[",
"off",
"++",
"]",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print values from short array
@param values short value array, must not be null
@param off offset to the first element
@param len number of elements to print
@return the context
@throws IOException it will be thrown for transport error | [
"Print",
"values",
"from",
"short",
"array"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L957-L962 |
141,914 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Float | public JBBPTextWriter Float(final float[] values, int off, int len) throws IOException {
while (len-- > 0) {
this.Float(values[off++]);
}
return this;
} | java | public JBBPTextWriter Float(final float[] values, int off, int len) throws IOException {
while (len-- > 0) {
this.Float(values[off++]);
}
return this;
} | [
"public",
"JBBPTextWriter",
"Float",
"(",
"final",
"float",
"[",
"]",
"values",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"while",
"(",
"len",
"--",
">",
"0",
")",
"{",
"this",
".",
"Float",
"(",
"values",
"[",
"off",
"++",
"]",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print values from float array
@param values float value array, must not be null
@param off offset to the first element
@param len number of elements to print
@return the context
@throws IOException it will be thrown for transport error
@since 1.4.0 | [
"Print",
"values",
"from",
"float",
"array"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L974-L979 |
141,915 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Double | public JBBPTextWriter Double(final double[] values, int off, int len) throws IOException {
while (len-- > 0) {
this.Double(values[off++]);
}
return this;
} | java | public JBBPTextWriter Double(final double[] values, int off, int len) throws IOException {
while (len-- > 0) {
this.Double(values[off++]);
}
return this;
} | [
"public",
"JBBPTextWriter",
"Double",
"(",
"final",
"double",
"[",
"]",
"values",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"while",
"(",
"len",
"--",
">",
"0",
")",
"{",
"this",
".",
"Double",
"(",
"values",
"[",
"off",
"++",
"]",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print values from double array
@param values double value array, must not be null
@param off offset to the first element
@param len number of elements to print
@return the context
@throws IOException it will be thrown for transport error
@since 1.4.0 | [
"Print",
"values",
"from",
"double",
"array"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L991-L996 |
141,916 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Int | public JBBPTextWriter Int(final int value) throws IOException {
ensureValueMode();
String convertedByExtras = null;
for (final Extra e : this.extras) {
convertedByExtras = e.doConvertIntToStr(this, value);
if (convertedByExtras != null) {
break;
}
}
if (convertedByExtras == null) {
final long valueToWrite;
if (this.byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
valueToWrite = JBBPUtils.reverseByteOrder(value, 4);
} else {
valueToWrite = value;
}
printValueString(JBBPUtils.ensureMinTextLength(JBBPUtils.ulong2str(valueToWrite & 0xFFFFFFFFL, this.radix, CHAR_BUFFER), this.maxCharsRadixForInt, '0', 0));
} else {
printValueString(convertedByExtras);
}
return this;
} | java | public JBBPTextWriter Int(final int value) throws IOException {
ensureValueMode();
String convertedByExtras = null;
for (final Extra e : this.extras) {
convertedByExtras = e.doConvertIntToStr(this, value);
if (convertedByExtras != null) {
break;
}
}
if (convertedByExtras == null) {
final long valueToWrite;
if (this.byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
valueToWrite = JBBPUtils.reverseByteOrder(value, 4);
} else {
valueToWrite = value;
}
printValueString(JBBPUtils.ensureMinTextLength(JBBPUtils.ulong2str(valueToWrite & 0xFFFFFFFFL, this.radix, CHAR_BUFFER), this.maxCharsRadixForInt, '0', 0));
} else {
printValueString(convertedByExtras);
}
return this;
} | [
"public",
"JBBPTextWriter",
"Int",
"(",
"final",
"int",
"value",
")",
"throws",
"IOException",
"{",
"ensureValueMode",
"(",
")",
";",
"String",
"convertedByExtras",
"=",
"null",
";",
"for",
"(",
"final",
"Extra",
"e",
":",
"this",
".",
"extras",
")",
"{",
"convertedByExtras",
"=",
"e",
".",
"doConvertIntToStr",
"(",
"this",
",",
"value",
")",
";",
"if",
"(",
"convertedByExtras",
"!=",
"null",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"convertedByExtras",
"==",
"null",
")",
"{",
"final",
"long",
"valueToWrite",
";",
"if",
"(",
"this",
".",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"LITTLE_ENDIAN",
")",
"{",
"valueToWrite",
"=",
"JBBPUtils",
".",
"reverseByteOrder",
"(",
"value",
",",
"4",
")",
";",
"}",
"else",
"{",
"valueToWrite",
"=",
"value",
";",
"}",
"printValueString",
"(",
"JBBPUtils",
".",
"ensureMinTextLength",
"(",
"JBBPUtils",
".",
"ulong2str",
"(",
"valueToWrite",
"&",
"0xFFFFFFFF",
"L",
",",
"this",
".",
"radix",
",",
"CHAR_BUFFER",
")",
",",
"this",
".",
"maxCharsRadixForInt",
",",
"'",
"'",
",",
"0",
")",
")",
";",
"}",
"else",
"{",
"printValueString",
"(",
"convertedByExtras",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print integer value
@param value value to be printed
@return the context
@throws IOException it will be thrown for transport error | [
"Print",
"integer",
"value"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L1005-L1028 |
141,917 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Int | public JBBPTextWriter Int(final int[] values, int off, int len) throws IOException {
while (len-- > 0) {
this.Int(values[off++]);
}
return this;
} | java | public JBBPTextWriter Int(final int[] values, int off, int len) throws IOException {
while (len-- > 0) {
this.Int(values[off++]);
}
return this;
} | [
"public",
"JBBPTextWriter",
"Int",
"(",
"final",
"int",
"[",
"]",
"values",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"while",
"(",
"len",
"--",
">",
"0",
")",
"{",
"this",
".",
"Int",
"(",
"values",
"[",
"off",
"++",
"]",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print values from integer array.
@param values integer array, must not be null
@param off offset to the first element in array
@param len number of elements to print
@return the context
@throws IOException it will be thrown for transport error | [
"Print",
"values",
"from",
"integer",
"array",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L1050-L1055 |
141,918 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Long | public JBBPTextWriter Long(final long value) throws IOException {
ensureValueMode();
String convertedByExtras = null;
for (final Extra e : this.extras) {
convertedByExtras = e.doConvertLongToStr(this, value);
if (convertedByExtras != null) {
break;
}
}
if (convertedByExtras == null) {
final long valueToWrite;
if (this.byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
valueToWrite = JBBPUtils.reverseByteOrder(value, 8);
} else {
valueToWrite = value;
}
printValueString(JBBPUtils.ensureMinTextLength(JBBPUtils.ulong2str(valueToWrite, this.radix, CHAR_BUFFER), this.maxCharsRadixForLong, '0', 0));
} else {
printValueString(convertedByExtras);
}
return this;
} | java | public JBBPTextWriter Long(final long value) throws IOException {
ensureValueMode();
String convertedByExtras = null;
for (final Extra e : this.extras) {
convertedByExtras = e.doConvertLongToStr(this, value);
if (convertedByExtras != null) {
break;
}
}
if (convertedByExtras == null) {
final long valueToWrite;
if (this.byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
valueToWrite = JBBPUtils.reverseByteOrder(value, 8);
} else {
valueToWrite = value;
}
printValueString(JBBPUtils.ensureMinTextLength(JBBPUtils.ulong2str(valueToWrite, this.radix, CHAR_BUFFER), this.maxCharsRadixForLong, '0', 0));
} else {
printValueString(convertedByExtras);
}
return this;
} | [
"public",
"JBBPTextWriter",
"Long",
"(",
"final",
"long",
"value",
")",
"throws",
"IOException",
"{",
"ensureValueMode",
"(",
")",
";",
"String",
"convertedByExtras",
"=",
"null",
";",
"for",
"(",
"final",
"Extra",
"e",
":",
"this",
".",
"extras",
")",
"{",
"convertedByExtras",
"=",
"e",
".",
"doConvertLongToStr",
"(",
"this",
",",
"value",
")",
";",
"if",
"(",
"convertedByExtras",
"!=",
"null",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"convertedByExtras",
"==",
"null",
")",
"{",
"final",
"long",
"valueToWrite",
";",
"if",
"(",
"this",
".",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"LITTLE_ENDIAN",
")",
"{",
"valueToWrite",
"=",
"JBBPUtils",
".",
"reverseByteOrder",
"(",
"value",
",",
"8",
")",
";",
"}",
"else",
"{",
"valueToWrite",
"=",
"value",
";",
"}",
"printValueString",
"(",
"JBBPUtils",
".",
"ensureMinTextLength",
"(",
"JBBPUtils",
".",
"ulong2str",
"(",
"valueToWrite",
",",
"this",
".",
"radix",
",",
"CHAR_BUFFER",
")",
",",
"this",
".",
"maxCharsRadixForLong",
",",
"'",
"'",
",",
"0",
")",
")",
";",
"}",
"else",
"{",
"printValueString",
"(",
"convertedByExtras",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print long value
@param value value to be printed
@return the context
@throws IOException it will be thrown for transport errors | [
"Print",
"long",
"value"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L1116-L1139 |
141,919 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Long | public JBBPTextWriter Long(final long[] values, int off, int len) throws IOException {
while (len-- > 0) {
this.Long(values[off++]);
}
return this;
} | java | public JBBPTextWriter Long(final long[] values, int off, int len) throws IOException {
while (len-- > 0) {
this.Long(values[off++]);
}
return this;
} | [
"public",
"JBBPTextWriter",
"Long",
"(",
"final",
"long",
"[",
"]",
"values",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"while",
"(",
"len",
"--",
">",
"0",
")",
"{",
"this",
".",
"Long",
"(",
"values",
"[",
"off",
"++",
"]",
")",
";",
"}",
"return",
"this",
";",
"}"
] | print values from long array.
@param values array to be printed, must not be null
@param off offset to the first element to print
@param len number of elements to be printed
@return the context
@throws IOException it will be thrown for transport errors | [
"print",
"values",
"from",
"long",
"array",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L1161-L1166 |
141,920 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.SetHR | public JBBPTextWriter SetHR(final String prefix, final int length, final char ch) {
this.prefixHR = prefix == null ? "" : prefix;
this.hrChar = ch;
this.hrLength = length;
return this;
} | java | public JBBPTextWriter SetHR(final String prefix, final int length, final char ch) {
this.prefixHR = prefix == null ? "" : prefix;
this.hrChar = ch;
this.hrLength = length;
return this;
} | [
"public",
"JBBPTextWriter",
"SetHR",
"(",
"final",
"String",
"prefix",
",",
"final",
"int",
"length",
",",
"final",
"char",
"ch",
")",
"{",
"this",
".",
"prefixHR",
"=",
"prefix",
"==",
"null",
"?",
"\"\"",
":",
"prefix",
";",
"this",
".",
"hrChar",
"=",
"ch",
";",
"this",
".",
"hrLength",
"=",
"length",
";",
"return",
"this",
";",
"}"
] | Change parameters for horizontal rule.
@param prefix the prefix to be printed before rule, it can be null
@param length the length in symbols.
@param ch symbol to draw
@return the context | [
"Change",
"parameters",
"for",
"horizontal",
"rule",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L1188-L1193 |
141,921 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.HR | public JBBPTextWriter HR() throws IOException {
if (this.flagCommentsAllowed) {
this.ensureNewLineMode();
this.writeIndent();
this.write(this.prefixHR);
for (int i = 0; i < this.hrLength; i++) {
this.write(this.hrChar);
}
}
this.BR();
return this;
} | java | public JBBPTextWriter HR() throws IOException {
if (this.flagCommentsAllowed) {
this.ensureNewLineMode();
this.writeIndent();
this.write(this.prefixHR);
for (int i = 0; i < this.hrLength; i++) {
this.write(this.hrChar);
}
}
this.BR();
return this;
} | [
"public",
"JBBPTextWriter",
"HR",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"flagCommentsAllowed",
")",
"{",
"this",
".",
"ensureNewLineMode",
"(",
")",
";",
"this",
".",
"writeIndent",
"(",
")",
";",
"this",
".",
"write",
"(",
"this",
".",
"prefixHR",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"hrLength",
";",
"i",
"++",
")",
"{",
"this",
".",
"write",
"(",
"this",
".",
"hrChar",
")",
";",
"}",
"}",
"this",
".",
"BR",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Print horizontal rule. If comments are disabled then only next line will be
added.
@return the context
@throws IOException it will be thrown for transport errors
@see #EnableComments()
@see #DisableComments() | [
"Print",
"horizontal",
"rule",
".",
"If",
"comments",
"are",
"disabled",
"then",
"only",
"next",
"line",
"will",
"be",
"added",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L1204-L1215 |
141,922 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Comment | public JBBPTextWriter Comment(final String... comment) throws IOException {
if (this.flagCommentsAllowed) {
if (comment != null) {
for (final String c : comment) {
if (c == null) {
continue;
}
if (c.indexOf('\n') >= 0) {
final String[] splitted = c.split("\\n", -1);
for (final String s : splitted) {
this.ensureCommentMode();
this.write(s);
}
} else {
this.ensureCommentMode();
this.write(c);
}
}
this.prevLineCommentsStartPosition = 0;
}
} else {
ensureNewLineMode();
}
return this;
} | java | public JBBPTextWriter Comment(final String... comment) throws IOException {
if (this.flagCommentsAllowed) {
if (comment != null) {
for (final String c : comment) {
if (c == null) {
continue;
}
if (c.indexOf('\n') >= 0) {
final String[] splitted = c.split("\\n", -1);
for (final String s : splitted) {
this.ensureCommentMode();
this.write(s);
}
} else {
this.ensureCommentMode();
this.write(c);
}
}
this.prevLineCommentsStartPosition = 0;
}
} else {
ensureNewLineMode();
}
return this;
} | [
"public",
"JBBPTextWriter",
"Comment",
"(",
"final",
"String",
"...",
"comment",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"flagCommentsAllowed",
")",
"{",
"if",
"(",
"comment",
"!=",
"null",
")",
"{",
"for",
"(",
"final",
"String",
"c",
":",
"comment",
")",
"{",
"if",
"(",
"c",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"c",
".",
"indexOf",
"(",
"'",
"'",
")",
">=",
"0",
")",
"{",
"final",
"String",
"[",
"]",
"splitted",
"=",
"c",
".",
"split",
"(",
"\"\\\\n\"",
",",
"-",
"1",
")",
";",
"for",
"(",
"final",
"String",
"s",
":",
"splitted",
")",
"{",
"this",
".",
"ensureCommentMode",
"(",
")",
";",
"this",
".",
"write",
"(",
"s",
")",
";",
"}",
"}",
"else",
"{",
"this",
".",
"ensureCommentMode",
"(",
")",
";",
"this",
".",
"write",
"(",
"c",
")",
";",
"}",
"}",
"this",
".",
"prevLineCommentsStartPosition",
"=",
"0",
";",
"}",
"}",
"else",
"{",
"ensureNewLineMode",
"(",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print comments. Wilt aligning of line start for multi-line comment.
Comments will be printed only if they are allowed.
@param comment array of string to be printed as comment lines.
@return the context
@throws IOException it will be thrown for transport errors
@see #EnableComments()
@see #DisableComments() | [
"Print",
"comments",
".",
"Wilt",
"aligning",
"of",
"line",
"start",
"for",
"multi",
"-",
"line",
"comment",
".",
"Comments",
"will",
"be",
"printed",
"only",
"if",
"they",
"are",
"allowed",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L1227-L1252 |
141,923 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Obj | public JBBPTextWriter Obj(final int objId, final Object... obj) throws IOException {
if (this.extras.isEmpty()) {
throw new IllegalStateException("There is not any registered extras");
}
for (final Object c : obj) {
String str = null;
for (final Extra e : this.extras) {
str = e.doConvertObjToStr(this, objId, c);
if (str != null) {
break;
}
}
if (str != null) {
ensureValueMode();
printValueString(str);
}
}
return this;
} | java | public JBBPTextWriter Obj(final int objId, final Object... obj) throws IOException {
if (this.extras.isEmpty()) {
throw new IllegalStateException("There is not any registered extras");
}
for (final Object c : obj) {
String str = null;
for (final Extra e : this.extras) {
str = e.doConvertObjToStr(this, objId, c);
if (str != null) {
break;
}
}
if (str != null) {
ensureValueMode();
printValueString(str);
}
}
return this;
} | [
"public",
"JBBPTextWriter",
"Obj",
"(",
"final",
"int",
"objId",
",",
"final",
"Object",
"...",
"obj",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"extras",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"There is not any registered extras\"",
")",
";",
"}",
"for",
"(",
"final",
"Object",
"c",
":",
"obj",
")",
"{",
"String",
"str",
"=",
"null",
";",
"for",
"(",
"final",
"Extra",
"e",
":",
"this",
".",
"extras",
")",
"{",
"str",
"=",
"e",
".",
"doConvertObjToStr",
"(",
"this",
",",
"objId",
",",
"c",
")",
";",
"if",
"(",
"str",
"!=",
"null",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"str",
"!=",
"null",
")",
"{",
"ensureValueMode",
"(",
")",
";",
"printValueString",
"(",
"str",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | Print objects.
@param objId object id which will be provided to a converter as extra info
@param obj objects to be converted and printed, must not be null
@return the context
@throws IOException it will be thrown for transport errors | [
"Print",
"objects",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L1273-L1293 |
141,924 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Obj | public JBBPTextWriter Obj(final int objId, final Object[] array, int off, int len) throws IOException {
while (len-- > 0) {
this.Obj(objId, array[off++]);
}
return this;
} | java | public JBBPTextWriter Obj(final int objId, final Object[] array, int off, int len) throws IOException {
while (len-- > 0) {
this.Obj(objId, array[off++]);
}
return this;
} | [
"public",
"JBBPTextWriter",
"Obj",
"(",
"final",
"int",
"objId",
",",
"final",
"Object",
"[",
"]",
"array",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"while",
"(",
"len",
"--",
">",
"0",
")",
"{",
"this",
".",
"Obj",
"(",
"objId",
",",
"array",
"[",
"off",
"++",
"]",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Print objects from array.
@param objId object id which will be provided to a converter as extra info
@param array array of objects, must not be null
@param off offset to the first element to be printed
@param len number of elements to be printed
@return the context
@throws IOException it will be thrown for transport errors | [
"Print",
"objects",
"from",
"array",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L1305-L1310 |
141,925 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.writeChar | private void writeChar(final char chr) throws IOException {
switch (chr) {
case '\t':
this.Tab();
break;
case '\n': {
this.out.write(this.lineSeparator);
this.lineNumber++;
this.prevMode = this.mode;
this.mode = MODE_START_LINE;
this.linePosition = 0;
for (final Extra e : extras) {
e.onNewLine(this, this.lineNumber);
}
}
break;
case '\r':
break;
default: {
if (!Character.isISOControl(chr)) {
this.out.write(chr);
this.linePosition++;
if (this.mode == MODE_START_LINE) {
this.mode = this.prevMode;
}
}
}
break;
}
} | java | private void writeChar(final char chr) throws IOException {
switch (chr) {
case '\t':
this.Tab();
break;
case '\n': {
this.out.write(this.lineSeparator);
this.lineNumber++;
this.prevMode = this.mode;
this.mode = MODE_START_LINE;
this.linePosition = 0;
for (final Extra e : extras) {
e.onNewLine(this, this.lineNumber);
}
}
break;
case '\r':
break;
default: {
if (!Character.isISOControl(chr)) {
this.out.write(chr);
this.linePosition++;
if (this.mode == MODE_START_LINE) {
this.mode = this.prevMode;
}
}
}
break;
}
} | [
"private",
"void",
"writeChar",
"(",
"final",
"char",
"chr",
")",
"throws",
"IOException",
"{",
"switch",
"(",
"chr",
")",
"{",
"case",
"'",
"'",
":",
"this",
".",
"Tab",
"(",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"{",
"this",
".",
"out",
".",
"write",
"(",
"this",
".",
"lineSeparator",
")",
";",
"this",
".",
"lineNumber",
"++",
";",
"this",
".",
"prevMode",
"=",
"this",
".",
"mode",
";",
"this",
".",
"mode",
"=",
"MODE_START_LINE",
";",
"this",
".",
"linePosition",
"=",
"0",
";",
"for",
"(",
"final",
"Extra",
"e",
":",
"extras",
")",
"{",
"e",
".",
"onNewLine",
"(",
"this",
",",
"this",
".",
"lineNumber",
")",
";",
"}",
"}",
"break",
";",
"case",
"'",
"'",
":",
"break",
";",
"default",
":",
"{",
"if",
"(",
"!",
"Character",
".",
"isISOControl",
"(",
"chr",
")",
")",
"{",
"this",
".",
"out",
".",
"write",
"(",
"chr",
")",
";",
"this",
".",
"linePosition",
"++",
";",
"if",
"(",
"this",
".",
"mode",
"==",
"MODE_START_LINE",
")",
"{",
"this",
".",
"mode",
"=",
"this",
".",
"prevMode",
";",
"}",
"}",
"}",
"break",
";",
"}",
"}"
] | Main method writing a char into wrapped writer.
@param chr a char to be written.
@throws IOException it will be thrown for transport errors. | [
"Main",
"method",
"writing",
"a",
"char",
"into",
"wrapped",
"writer",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L1511-L1540 |
141,926 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.BeginBin | public static JBBPOut BeginBin(final JBBPByteOrder byteOrder, final JBBPBitOrder bitOrder) {
return new JBBPOut(new ByteArrayOutputStream(), byteOrder, bitOrder);
} | java | public static JBBPOut BeginBin(final JBBPByteOrder byteOrder, final JBBPBitOrder bitOrder) {
return new JBBPOut(new ByteArrayOutputStream(), byteOrder, bitOrder);
} | [
"public",
"static",
"JBBPOut",
"BeginBin",
"(",
"final",
"JBBPByteOrder",
"byteOrder",
",",
"final",
"JBBPBitOrder",
"bitOrder",
")",
"{",
"return",
"new",
"JBBPOut",
"(",
"new",
"ByteArrayOutputStream",
"(",
")",
",",
"byteOrder",
",",
"bitOrder",
")",
";",
"}"
] | Start a DSL session for defined both byte outOrder and bit outOrder parameters.
@param byteOrder the byte outOrder to be used for the session
@param bitOrder the bit outOrder to be used for the session
@return the new DSL session generated with the parameters and inside byte
array stream. | [
"Start",
"a",
"DSL",
"session",
"for",
"defined",
"both",
"byte",
"outOrder",
"and",
"bit",
"outOrder",
"parameters",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L107-L109 |
141,927 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.BeginBin | public static JBBPOut BeginBin(final OutputStream out, final JBBPByteOrder byteOrder, final JBBPBitOrder bitOrder) {
return new JBBPOut(out, byteOrder, bitOrder);
} | java | public static JBBPOut BeginBin(final OutputStream out, final JBBPByteOrder byteOrder, final JBBPBitOrder bitOrder) {
return new JBBPOut(out, byteOrder, bitOrder);
} | [
"public",
"static",
"JBBPOut",
"BeginBin",
"(",
"final",
"OutputStream",
"out",
",",
"final",
"JBBPByteOrder",
"byteOrder",
",",
"final",
"JBBPBitOrder",
"bitOrder",
")",
"{",
"return",
"new",
"JBBPOut",
"(",
"out",
",",
"byteOrder",
",",
"bitOrder",
")",
";",
"}"
] | Start a DSL session for a defined stream with defined parameters.
@param out the defined stream
@param byteOrder the byte outOrder for the session
@param bitOrder the bit outOrder for the session
@return the new DSL session generated for the stream with parameters | [
"Start",
"a",
"DSL",
"session",
"for",
"a",
"defined",
"stream",
"with",
"defined",
"parameters",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L119-L121 |
141,928 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Skip | public JBBPOut Skip(int numberOfBytes) throws IOException {
assertNotEnded();
if (this.processCommands) {
if (numberOfBytes < 0) {
throw new IllegalArgumentException("Value is negative");
}
this.Align();
while (numberOfBytes > 0) {
this.outStream.write(0);
numberOfBytes--;
}
}
return this;
} | java | public JBBPOut Skip(int numberOfBytes) throws IOException {
assertNotEnded();
if (this.processCommands) {
if (numberOfBytes < 0) {
throw new IllegalArgumentException("Value is negative");
}
this.Align();
while (numberOfBytes > 0) {
this.outStream.write(0);
numberOfBytes--;
}
}
return this;
} | [
"public",
"JBBPOut",
"Skip",
"(",
"int",
"numberOfBytes",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"if",
"(",
"numberOfBytes",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Value is negative\"",
")",
";",
"}",
"this",
".",
"Align",
"(",
")",
";",
"while",
"(",
"numberOfBytes",
">",
"0",
")",
"{",
"this",
".",
"outStream",
".",
"write",
"(",
"0",
")",
";",
"numberOfBytes",
"--",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | Skip number of bytes in the stream, zero bytes will be written and also
will be aligned inside bit cache even if the value is 0.
@param numberOfBytes the number of bytes to be skipped
@return the DSL session
@throws IOException it will be thrown for transport errors
@throws IllegalArgumentException it will be thrown if the value is negative
one | [
"Skip",
"number",
"of",
"bytes",
"in",
"the",
"stream",
"zero",
"bytes",
"will",
"be",
"written",
"and",
"also",
"will",
"be",
"aligned",
"inside",
"bit",
"cache",
"even",
"if",
"the",
"value",
"is",
"0",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L241-L254 |
141,929 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.ByteOrder | public JBBPOut ByteOrder(final JBBPByteOrder value) throws IOException {
assertNotEnded();
JBBPUtils.assertNotNull(value, "Byte order must not be null");
if (this.processCommands) {
this.byteOrder = value;
}
return this;
} | java | public JBBPOut ByteOrder(final JBBPByteOrder value) throws IOException {
assertNotEnded();
JBBPUtils.assertNotNull(value, "Byte order must not be null");
if (this.processCommands) {
this.byteOrder = value;
}
return this;
} | [
"public",
"JBBPOut",
"ByteOrder",
"(",
"final",
"JBBPByteOrder",
"value",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"JBBPUtils",
".",
"assertNotNull",
"(",
"value",
",",
"\"Byte order must not be null\"",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"this",
".",
"byteOrder",
"=",
"value",
";",
"}",
"return",
"this",
";",
"}"
] | Define the byte outOrder for next session operations.
@param value the byte outOrder to be used in next operations, must not be null
@return the DSL session
@throws IOException it will be thrown for transport errors | [
"Define",
"the",
"byte",
"outOrder",
"for",
"next",
"session",
"operations",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L263-L270 |
141,930 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Bit | public JBBPOut Bit(final boolean value) throws IOException {
assertNotEnded();
if (this.processCommands) {
this.outStream.writeBits(value ? 1 : 0, JBBPBitNumber.BITS_1);
}
return this;
} | java | public JBBPOut Bit(final boolean value) throws IOException {
assertNotEnded();
if (this.processCommands) {
this.outStream.writeBits(value ? 1 : 0, JBBPBitNumber.BITS_1);
}
return this;
} | [
"public",
"JBBPOut",
"Bit",
"(",
"final",
"boolean",
"value",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"this",
".",
"outStream",
".",
"writeBits",
"(",
"value",
"?",
"1",
":",
"0",
",",
"JBBPBitNumber",
".",
"BITS_1",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Write a bit into the session.
@param value true if the bit is 1, 0 otherwise
@return the DSL session
@throws IOException it will be thrown for transport errors | [
"Write",
"a",
"bit",
"into",
"the",
"session",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L279-L285 |
141,931 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Bit | public JBBPOut Bit(final byte value) throws IOException {
assertNotEnded();
if (this.processCommands) {
this._writeBits(JBBPBitNumber.BITS_1, value);
}
return this;
} | java | public JBBPOut Bit(final byte value) throws IOException {
assertNotEnded();
if (this.processCommands) {
this._writeBits(JBBPBitNumber.BITS_1, value);
}
return this;
} | [
"public",
"JBBPOut",
"Bit",
"(",
"final",
"byte",
"value",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"this",
".",
"_writeBits",
"(",
"JBBPBitNumber",
".",
"BITS_1",
",",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Write the lowest bit from a byte value.
@param value the byte value which lowest bit will be written into the
stream
@return the DSL session
@throws IOException it will be thrown for transport errors | [
"Write",
"the",
"lowest",
"bit",
"from",
"a",
"byte",
"value",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L295-L301 |
141,932 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Bits | public JBBPOut Bits(final JBBPBitNumber numberOfBits, final int value) throws IOException {
assertNotEnded();
JBBPUtils.assertNotNull(numberOfBits, "Number of bits must not be null");
if (this.processCommands) {
_writeBits(numberOfBits, value);
}
return this;
} | java | public JBBPOut Bits(final JBBPBitNumber numberOfBits, final int value) throws IOException {
assertNotEnded();
JBBPUtils.assertNotNull(numberOfBits, "Number of bits must not be null");
if (this.processCommands) {
_writeBits(numberOfBits, value);
}
return this;
} | [
"public",
"JBBPOut",
"Bits",
"(",
"final",
"JBBPBitNumber",
"numberOfBits",
",",
"final",
"int",
"value",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"JBBPUtils",
".",
"assertNotNull",
"(",
"numberOfBits",
",",
"\"Number of bits must not be null\"",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"_writeBits",
"(",
"numberOfBits",
",",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Write bits from a value into the output stream
@param numberOfBits the number of bits to be saved
@param value the value which bits must be saved
@return the DSL session
@throws IOException it will be thrown for transport errors | [
"Write",
"bits",
"from",
"a",
"value",
"into",
"the",
"output",
"stream"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L380-L387 |
141,933 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Byte | public JBBPOut Byte(final int... value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
for (final int v : value) {
_writeByte(v);
}
}
return this;
} | java | public JBBPOut Byte(final int... value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
for (final int v : value) {
_writeByte(v);
}
}
return this;
} | [
"public",
"JBBPOut",
"Byte",
"(",
"final",
"int",
"...",
"value",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"assertArrayNotNull",
"(",
"value",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"for",
"(",
"final",
"int",
"v",
":",
"value",
")",
"{",
"_writeByte",
"(",
"v",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | Write the lower byte of an integer value into the session stream.
@param value an integer array which values will be byte sources to write
their lower byte into the stream
@return the DSL session
@throws IOException it will be thrown for transport errors | [
"Write",
"the",
"lower",
"byte",
"of",
"an",
"integer",
"value",
"into",
"the",
"session",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L462-L471 |
141,934 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Byte | public JBBPOut Byte(final byte[] value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
this.outStream.write(value);
}
return this;
} | java | public JBBPOut Byte(final byte[] value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
this.outStream.write(value);
}
return this;
} | [
"public",
"JBBPOut",
"Byte",
"(",
"final",
"byte",
"[",
"]",
"value",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"assertArrayNotNull",
"(",
"value",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"this",
".",
"outStream",
".",
"write",
"(",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Write a byte array into the session stream.
@param value a byte array to be written
@return the DSL session
@throws IOException it will be thrown for transport errors | [
"Write",
"a",
"byte",
"array",
"into",
"the",
"session",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L480-L487 |
141,935 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Utf8 | public JBBPOut Utf8(final String str) throws IOException {
assertNotEnded();
assertStringNotNull(str);
if (this.processCommands) {
this.outStream.write(JBBPUtils.strToUtf8(str));
}
return this;
} | java | public JBBPOut Utf8(final String str) throws IOException {
assertNotEnded();
assertStringNotNull(str);
if (this.processCommands) {
this.outStream.write(JBBPUtils.strToUtf8(str));
}
return this;
} | [
"public",
"JBBPOut",
"Utf8",
"(",
"final",
"String",
"str",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"assertStringNotNull",
"(",
"str",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"this",
".",
"outStream",
".",
"write",
"(",
"JBBPUtils",
".",
"strToUtf8",
"(",
"str",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Write chars of a String as encoded Utf8 byte array. There will not be aby information about string length.
@param str a String which bytes should be written as Utf8, must not be null
@return the DSL session
@throws IOException it will be thrown for transport errors | [
"Write",
"chars",
"of",
"a",
"String",
"as",
"encoded",
"Utf8",
"byte",
"array",
".",
"There",
"will",
"not",
"be",
"aby",
"information",
"about",
"string",
"length",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L540-L547 |
141,936 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Bool | public JBBPOut Bool(final boolean value, final JBBPBitOrder bitOrder) throws IOException {
assertNotEnded();
if (this.processCommands) {
this.outStream.write(value ? bitOrder == JBBPBitOrder.MSB0 ? 0x80 : 1 : 0);
}
return this;
} | java | public JBBPOut Bool(final boolean value, final JBBPBitOrder bitOrder) throws IOException {
assertNotEnded();
if (this.processCommands) {
this.outStream.write(value ? bitOrder == JBBPBitOrder.MSB0 ? 0x80 : 1 : 0);
}
return this;
} | [
"public",
"JBBPOut",
"Bool",
"(",
"final",
"boolean",
"value",
",",
"final",
"JBBPBitOrder",
"bitOrder",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"this",
".",
"outStream",
".",
"write",
"(",
"value",
"?",
"bitOrder",
"==",
"JBBPBitOrder",
".",
"MSB0",
"?",
"0x80",
":",
"1",
":",
"0",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Write a boolean value into the session stream as a byte.
@param value a boolean value to be written, true is 1, false is 0
@param bitOrder bit outOrder for saving data
@return the DSL session
@throws IOException it will be thrown for transport errors
@since 1.1 | [
"Write",
"a",
"boolean",
"value",
"into",
"the",
"session",
"stream",
"as",
"a",
"byte",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L605-L611 |
141,937 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Bool | public JBBPOut Bool(final boolean... value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
for (final boolean b : value) {
this.outStream.write(b ? 1 : 0);
}
}
return this;
} | java | public JBBPOut Bool(final boolean... value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
for (final boolean b : value) {
this.outStream.write(b ? 1 : 0);
}
}
return this;
} | [
"public",
"JBBPOut",
"Bool",
"(",
"final",
"boolean",
"...",
"value",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"assertArrayNotNull",
"(",
"value",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"for",
"(",
"final",
"boolean",
"b",
":",
"value",
")",
"{",
"this",
".",
"outStream",
".",
"write",
"(",
"b",
"?",
"1",
":",
"0",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | Write boolean values from an array into the session stream as bytes.
@param value a boolean array to be saved as bytes, true is 1, false is 0.
It must not be null
@return the DSL session
@throws IOException it will be thrown for transport errors | [
"Write",
"boolean",
"values",
"from",
"an",
"array",
"into",
"the",
"session",
"stream",
"as",
"bytes",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L621-L630 |
141,938 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Short | public JBBPOut Short(final short[] value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
for (final short v : value) {
this._writeShort(v);
}
}
return this;
} | java | public JBBPOut Short(final short[] value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
for (final short v : value) {
this._writeShort(v);
}
}
return this;
} | [
"public",
"JBBPOut",
"Short",
"(",
"final",
"short",
"[",
"]",
"value",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"assertArrayNotNull",
"(",
"value",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"for",
"(",
"final",
"short",
"v",
":",
"value",
")",
"{",
"this",
".",
"_writeShort",
"(",
"v",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | Write short values from an array
@param value a short value array which values should be written into, it
must not be null
@return the DSL session
@throws IOException it will be thrown for transport errors | [
"Write",
"short",
"values",
"from",
"an",
"array"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L709-L718 |
141,939 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Int | public JBBPOut Int(final int... value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
for (final int v : value) {
_writeInt(v);
}
}
return this;
} | java | public JBBPOut Int(final int... value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
for (final int v : value) {
_writeInt(v);
}
}
return this;
} | [
"public",
"JBBPOut",
"Int",
"(",
"final",
"int",
"...",
"value",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"assertArrayNotNull",
"(",
"value",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"for",
"(",
"final",
"int",
"v",
":",
"value",
")",
"{",
"_writeInt",
"(",
"v",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | Write each integer value from an integer array into the session stream.
@param value an integer array which values should be written into
@return the DSl session
@throws IOException it will be thrown for transport errors | [
"Write",
"each",
"integer",
"value",
"from",
"an",
"integer",
"array",
"into",
"the",
"session",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L792-L801 |
141,940 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Float | public JBBPOut Float(final float... value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
for (final float f : value) {
_writeFloat(f);
}
}
return this;
} | java | public JBBPOut Float(final float... value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
for (final float f : value) {
_writeFloat(f);
}
}
return this;
} | [
"public",
"JBBPOut",
"Float",
"(",
"final",
"float",
"...",
"value",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"assertArrayNotNull",
"(",
"value",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"for",
"(",
"final",
"float",
"f",
":",
"value",
")",
"{",
"_writeFloat",
"(",
"f",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | Write a float value array as integer bits into the stream.
@param value a float array which values will be written into
@return the DSL session
@throws IOException it will be thrown for transport errors
@see Float#floatToIntBits(float)
@since 1.4.0 | [
"Write",
"a",
"float",
"value",
"array",
"as",
"integer",
"bits",
"into",
"the",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L812-L821 |
141,941 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Double | public JBBPOut Double(final double... value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
for (final double d : value) {
_writeDouble(d);
}
}
return this;
} | java | public JBBPOut Double(final double... value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
for (final double d : value) {
_writeDouble(d);
}
}
return this;
} | [
"public",
"JBBPOut",
"Double",
"(",
"final",
"double",
"...",
"value",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"assertArrayNotNull",
"(",
"value",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"for",
"(",
"final",
"double",
"d",
":",
"value",
")",
"{",
"_writeDouble",
"(",
"d",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | Write a double value array as long bits into the stream.
@param value a double array which values will be written into
@return the DSL session
@throws IOException it will be thrown for transport errors
@see Double#doubleToLongBits(double)
@since 1.4.0 | [
"Write",
"a",
"double",
"value",
"array",
"as",
"long",
"bits",
"into",
"the",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L882-L891 |
141,942 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Long | public JBBPOut Long(final long... value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
for (final long l : value) {
_writeLong(l);
}
}
return this;
} | java | public JBBPOut Long(final long... value) throws IOException {
assertNotEnded();
assertArrayNotNull(value);
if (this.processCommands) {
for (final long l : value) {
_writeLong(l);
}
}
return this;
} | [
"public",
"JBBPOut",
"Long",
"(",
"final",
"long",
"...",
"value",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"assertArrayNotNull",
"(",
"value",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"for",
"(",
"final",
"long",
"l",
":",
"value",
")",
"{",
"_writeLong",
"(",
"l",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | Write each long value from a long value array into the session stream.
@param value a long value array which values will be written into
@return the DSL session
@throws IOException it will be thrown for transport errors | [
"Write",
"each",
"long",
"value",
"from",
"a",
"long",
"value",
"array",
"into",
"the",
"session",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L917-L926 |
141,943 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Var | public JBBPOut Var(final JBBPOutVarProcessor processor, final Object... args) throws IOException {
assertNotEnded();
JBBPUtils.assertNotNull(processor, "Var processor must not be null");
if (this.processCommands) {
this.processCommands = processor.processVarOut(this, this.outStream, args);
}
return this;
} | java | public JBBPOut Var(final JBBPOutVarProcessor processor, final Object... args) throws IOException {
assertNotEnded();
JBBPUtils.assertNotNull(processor, "Var processor must not be null");
if (this.processCommands) {
this.processCommands = processor.processVarOut(this, this.outStream, args);
}
return this;
} | [
"public",
"JBBPOut",
"Var",
"(",
"final",
"JBBPOutVarProcessor",
"processor",
",",
"final",
"Object",
"...",
"args",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"JBBPUtils",
".",
"assertNotNull",
"(",
"processor",
",",
"\"Var processor must not be null\"",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"this",
".",
"processCommands",
"=",
"processor",
".",
"processVarOut",
"(",
"this",
",",
"this",
".",
"outStream",
",",
"args",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Output data externally.
@param processor a processor which will get the stream to write data, must
not be null
@param args optional arguments to be provided to the processor
@return the DSL context
@throws IOException it will be thrown for transport errors
@throws NullPointerException it will be thrown for null as a processor | [
"Output",
"data",
"externally",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L938-L945 |
141,944 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/varlen/JBBPEvaluatorFactory.java | JBBPEvaluatorFactory.make | public JBBPIntegerValueEvaluator make(final String expression, final List<JBBPNamedFieldInfo> namedFields, final byte[] compiledScript) {
final JBBPIntegerValueEvaluator result;
if (JBBPExpressionEvaluator.hasExpressionOperators(expression)) {
// expression
result = new JBBPExpressionEvaluator(expression, namedFields, compiledScript);
} else {
// only field
int index = -1;
if (expression.startsWith("$")) {
result = new JBBPOnlyFieldEvaluator(expression.substring(1), index);
} else {
for (int i = namedFields.size() - 1; i >= 0; i--) {
final JBBPNamedFieldInfo field = namedFields.get(i);
if (expression.equals(field.getFieldPath())) {
index = i;
break;
}
}
if (index < 0) {
result = new JBBPExpressionEvaluator(expression, namedFields, compiledScript);
} else {
JBBPCompilerUtils.assertFieldIsNotArrayOrInArray(namedFields.get(index), namedFields, compiledScript);
result = new JBBPOnlyFieldEvaluator(null, index);
}
}
}
return result;
} | java | public JBBPIntegerValueEvaluator make(final String expression, final List<JBBPNamedFieldInfo> namedFields, final byte[] compiledScript) {
final JBBPIntegerValueEvaluator result;
if (JBBPExpressionEvaluator.hasExpressionOperators(expression)) {
// expression
result = new JBBPExpressionEvaluator(expression, namedFields, compiledScript);
} else {
// only field
int index = -1;
if (expression.startsWith("$")) {
result = new JBBPOnlyFieldEvaluator(expression.substring(1), index);
} else {
for (int i = namedFields.size() - 1; i >= 0; i--) {
final JBBPNamedFieldInfo field = namedFields.get(i);
if (expression.equals(field.getFieldPath())) {
index = i;
break;
}
}
if (index < 0) {
result = new JBBPExpressionEvaluator(expression, namedFields, compiledScript);
} else {
JBBPCompilerUtils.assertFieldIsNotArrayOrInArray(namedFields.get(index), namedFields, compiledScript);
result = new JBBPOnlyFieldEvaluator(null, index);
}
}
}
return result;
} | [
"public",
"JBBPIntegerValueEvaluator",
"make",
"(",
"final",
"String",
"expression",
",",
"final",
"List",
"<",
"JBBPNamedFieldInfo",
">",
"namedFields",
",",
"final",
"byte",
"[",
"]",
"compiledScript",
")",
"{",
"final",
"JBBPIntegerValueEvaluator",
"result",
";",
"if",
"(",
"JBBPExpressionEvaluator",
".",
"hasExpressionOperators",
"(",
"expression",
")",
")",
"{",
"// expression",
"result",
"=",
"new",
"JBBPExpressionEvaluator",
"(",
"expression",
",",
"namedFields",
",",
"compiledScript",
")",
";",
"}",
"else",
"{",
"// only field",
"int",
"index",
"=",
"-",
"1",
";",
"if",
"(",
"expression",
".",
"startsWith",
"(",
"\"$\"",
")",
")",
"{",
"result",
"=",
"new",
"JBBPOnlyFieldEvaluator",
"(",
"expression",
".",
"substring",
"(",
"1",
")",
",",
"index",
")",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"namedFields",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"final",
"JBBPNamedFieldInfo",
"field",
"=",
"namedFields",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"expression",
".",
"equals",
"(",
"field",
".",
"getFieldPath",
"(",
")",
")",
")",
"{",
"index",
"=",
"i",
";",
"break",
";",
"}",
"}",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"result",
"=",
"new",
"JBBPExpressionEvaluator",
"(",
"expression",
",",
"namedFields",
",",
"compiledScript",
")",
";",
"}",
"else",
"{",
"JBBPCompilerUtils",
".",
"assertFieldIsNotArrayOrInArray",
"(",
"namedFields",
".",
"get",
"(",
"index",
")",
",",
"namedFields",
",",
"compiledScript",
")",
";",
"result",
"=",
"new",
"JBBPOnlyFieldEvaluator",
"(",
"null",
",",
"index",
")",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] | Make an appropriate evaluator for an expression text.
@param expression an expression text, must not be null
@param namedFields a named field list
@param compiledScript a compiled script block
@return a generated evaluator, it will not be null in any case
@see JBBPExpressionEvaluator
@see JBBPOnlyFieldEvaluator | [
"Make",
"an",
"appropriate",
"evaluator",
"for",
"an",
"expression",
"text",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/varlen/JBBPEvaluatorFactory.java#L56-L84 |
141,945 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiler.java | JBBPCompiler.assertName | private static void assertName(final String name, final JBBPToken token) {
if (name.indexOf('.') >= 0) {
throw new JBBPCompilationException("Detected disallowed char '.' in name [" + name + ']', token);
}
} | java | private static void assertName(final String name, final JBBPToken token) {
if (name.indexOf('.') >= 0) {
throw new JBBPCompilationException("Detected disallowed char '.' in name [" + name + ']', token);
}
} | [
"private",
"static",
"void",
"assertName",
"(",
"final",
"String",
"name",
",",
"final",
"JBBPToken",
"token",
")",
"{",
"if",
"(",
"name",
".",
"indexOf",
"(",
"'",
"'",
")",
">=",
"0",
")",
"{",
"throw",
"new",
"JBBPCompilationException",
"(",
"\"Detected disallowed char '.' in name [\"",
"+",
"name",
"+",
"'",
"'",
",",
"token",
")",
";",
"}",
"}"
] | The Method check that a field name supports business rules.
@param name the name to be checked
@param token the token contains the name
@throws JBBPCompilationException if the name doesn't support business rules | [
"The",
"Method",
"check",
"that",
"a",
"field",
"name",
"supports",
"business",
"rules",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiler.java#L495-L499 |
141,946 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiler.java | JBBPCompiler.registerNamedField | private static void registerNamedField(final String normalizedName, final int structureBorder, final int offset, final List<JBBPNamedFieldInfo> namedFields, final JBBPToken token) {
for (int i = namedFields.size() - 1; i >= structureBorder; i--) {
final JBBPNamedFieldInfo info = namedFields.get(i);
if (info.getFieldPath().equals(normalizedName)) {
throw new JBBPCompilationException("Duplicated named field detected [" + normalizedName + ']', token);
}
}
namedFields.add(new JBBPNamedFieldInfo(normalizedName, normalizedName, offset));
} | java | private static void registerNamedField(final String normalizedName, final int structureBorder, final int offset, final List<JBBPNamedFieldInfo> namedFields, final JBBPToken token) {
for (int i = namedFields.size() - 1; i >= structureBorder; i--) {
final JBBPNamedFieldInfo info = namedFields.get(i);
if (info.getFieldPath().equals(normalizedName)) {
throw new JBBPCompilationException("Duplicated named field detected [" + normalizedName + ']', token);
}
}
namedFields.add(new JBBPNamedFieldInfo(normalizedName, normalizedName, offset));
} | [
"private",
"static",
"void",
"registerNamedField",
"(",
"final",
"String",
"normalizedName",
",",
"final",
"int",
"structureBorder",
",",
"final",
"int",
"offset",
",",
"final",
"List",
"<",
"JBBPNamedFieldInfo",
">",
"namedFields",
",",
"final",
"JBBPToken",
"token",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"namedFields",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"structureBorder",
";",
"i",
"--",
")",
"{",
"final",
"JBBPNamedFieldInfo",
"info",
"=",
"namedFields",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"info",
".",
"getFieldPath",
"(",
")",
".",
"equals",
"(",
"normalizedName",
")",
")",
"{",
"throw",
"new",
"JBBPCompilationException",
"(",
"\"Duplicated named field detected [\"",
"+",
"normalizedName",
"+",
"'",
"'",
",",
"token",
")",
";",
"}",
"}",
"namedFields",
".",
"add",
"(",
"new",
"JBBPNamedFieldInfo",
"(",
"normalizedName",
",",
"normalizedName",
",",
"offset",
")",
")",
";",
"}"
] | Register a name field info item in a named field list.
@param normalizedName normalized name of the named field
@param offset the named field offset
@param namedFields the named field info list for registration
@param token the token for the field
@throws JBBPCompilationException if there is already a registered field for
the path | [
"Register",
"a",
"name",
"field",
"info",
"item",
"in",
"a",
"named",
"field",
"list",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiler.java#L511-L519 |
141,947 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiler.java | JBBPCompiler.writePackedInt | private static int writePackedInt(final OutputStream out, final int value) throws IOException {
final byte[] packedInt = JBBPUtils.packInt(value);
out.write(packedInt);
return packedInt.length;
} | java | private static int writePackedInt(final OutputStream out, final int value) throws IOException {
final byte[] packedInt = JBBPUtils.packInt(value);
out.write(packedInt);
return packedInt.length;
} | [
"private",
"static",
"int",
"writePackedInt",
"(",
"final",
"OutputStream",
"out",
",",
"final",
"int",
"value",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"packedInt",
"=",
"JBBPUtils",
".",
"packInt",
"(",
"value",
")",
";",
"out",
".",
"write",
"(",
"packedInt",
")",
";",
"return",
"packedInt",
".",
"length",
";",
"}"
] | Write an integer value in packed form into an output stream.
@param out the output stream to be used to write the value into
@param value the value to be written into the output stream
@return the length of packed data in bytes
@throws IOException it will be thrown for any IO problems | [
"Write",
"an",
"integer",
"value",
"in",
"packed",
"form",
"into",
"an",
"output",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiler.java#L529-L533 |
141,948 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiler.java | JBBPCompiler.prepareCodeForToken | private static int prepareCodeForToken(final JBBPToken token, final JBBPCustomFieldTypeProcessor customTypeFieldProcessor) {
int result = -1;
switch (token.getType()) {
case ATOM: {
final JBBPFieldTypeParameterContainer descriptor = token.getFieldTypeParameters();
result = descriptor.getByteOrder() == JBBPByteOrder.LITTLE_ENDIAN ? FLAG_LITTLE_ENDIAN : 0;
final boolean hasExpressionAsExtraNumber = descriptor.hasExpressionAsExtraData();
result |= token.getArraySizeAsString() == null ? 0 : (token.isVarArrayLength() ? FLAG_ARRAY | FLAG_WIDE | (EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8) : FLAG_ARRAY);
result |= hasExpressionAsExtraNumber ? FLAG_WIDE | (EXT_FLAG_EXTRA_AS_EXPRESSION << 8) : 0;
result |= token.getFieldTypeParameters().isSpecialField() ? FLAG_WIDE | (EXT_FLAG_EXTRA_DIFF_TYPE << 8) : 0;
result |= token.getFieldName() == null ? 0 : FLAG_NAMED;
final String name = descriptor.getTypeName().toLowerCase(Locale.ENGLISH);
switch (name) {
case "skip":
case "val":
result |= CODE_SKIP;
break;
case "align":
result |= CODE_ALIGN;
break;
case "bit":
result |= CODE_BIT;
break;
case "var":
result |= CODE_VAR;
break;
case "bool":
case JBBPFieldString.TYPE_NAME:
result |= CODE_BOOL;
break;
case "ubyte":
result |= CODE_UBYTE;
break;
case "byte":
result |= CODE_BYTE;
break;
case "ushort":
result |= CODE_USHORT;
break;
case "short":
result |= CODE_SHORT;
break;
case "int":
case JBBPFieldFloat.TYPE_NAME:
result |= CODE_INT;
break;
case "long":
case JBBPFieldDouble.TYPE_NAME:
result |= CODE_LONG;
break;
case "reset$$":
result |= CODE_RESET_COUNTER;
break;
default:
boolean unsupportedType = true;
if (customTypeFieldProcessor != null) {
for (final String s : customTypeFieldProcessor.getCustomFieldTypes()) {
if (name.equals(s)) {
result |= CODE_CUSTOMTYPE;
unsupportedType = false;
break;
}
}
}
if (unsupportedType) {
throw new JBBPCompilationException("Unsupported type [" + descriptor.getTypeName() + ']', token);
}
break;
}
}
break;
case COMMENT: {
// doesn't contain code
}
break;
case STRUCT_START: {
result = token.getArraySizeAsString() == null ? 0 : (token.isVarArrayLength() ? FLAG_ARRAY | FLAG_WIDE | (EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8) : FLAG_ARRAY);
result |= token.getFieldName() == null ? 0 : FLAG_NAMED;
result |= CODE_STRUCT_START;
}
break;
case STRUCT_END: {
result = CODE_STRUCT_END;
}
break;
default:
throw new Error("Unsupported type detected, contact developer! [" + token.getType() + ']');
}
return result;
} | java | private static int prepareCodeForToken(final JBBPToken token, final JBBPCustomFieldTypeProcessor customTypeFieldProcessor) {
int result = -1;
switch (token.getType()) {
case ATOM: {
final JBBPFieldTypeParameterContainer descriptor = token.getFieldTypeParameters();
result = descriptor.getByteOrder() == JBBPByteOrder.LITTLE_ENDIAN ? FLAG_LITTLE_ENDIAN : 0;
final boolean hasExpressionAsExtraNumber = descriptor.hasExpressionAsExtraData();
result |= token.getArraySizeAsString() == null ? 0 : (token.isVarArrayLength() ? FLAG_ARRAY | FLAG_WIDE | (EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8) : FLAG_ARRAY);
result |= hasExpressionAsExtraNumber ? FLAG_WIDE | (EXT_FLAG_EXTRA_AS_EXPRESSION << 8) : 0;
result |= token.getFieldTypeParameters().isSpecialField() ? FLAG_WIDE | (EXT_FLAG_EXTRA_DIFF_TYPE << 8) : 0;
result |= token.getFieldName() == null ? 0 : FLAG_NAMED;
final String name = descriptor.getTypeName().toLowerCase(Locale.ENGLISH);
switch (name) {
case "skip":
case "val":
result |= CODE_SKIP;
break;
case "align":
result |= CODE_ALIGN;
break;
case "bit":
result |= CODE_BIT;
break;
case "var":
result |= CODE_VAR;
break;
case "bool":
case JBBPFieldString.TYPE_NAME:
result |= CODE_BOOL;
break;
case "ubyte":
result |= CODE_UBYTE;
break;
case "byte":
result |= CODE_BYTE;
break;
case "ushort":
result |= CODE_USHORT;
break;
case "short":
result |= CODE_SHORT;
break;
case "int":
case JBBPFieldFloat.TYPE_NAME:
result |= CODE_INT;
break;
case "long":
case JBBPFieldDouble.TYPE_NAME:
result |= CODE_LONG;
break;
case "reset$$":
result |= CODE_RESET_COUNTER;
break;
default:
boolean unsupportedType = true;
if (customTypeFieldProcessor != null) {
for (final String s : customTypeFieldProcessor.getCustomFieldTypes()) {
if (name.equals(s)) {
result |= CODE_CUSTOMTYPE;
unsupportedType = false;
break;
}
}
}
if (unsupportedType) {
throw new JBBPCompilationException("Unsupported type [" + descriptor.getTypeName() + ']', token);
}
break;
}
}
break;
case COMMENT: {
// doesn't contain code
}
break;
case STRUCT_START: {
result = token.getArraySizeAsString() == null ? 0 : (token.isVarArrayLength() ? FLAG_ARRAY | FLAG_WIDE | (EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8) : FLAG_ARRAY);
result |= token.getFieldName() == null ? 0 : FLAG_NAMED;
result |= CODE_STRUCT_START;
}
break;
case STRUCT_END: {
result = CODE_STRUCT_END;
}
break;
default:
throw new Error("Unsupported type detected, contact developer! [" + token.getType() + ']');
}
return result;
} | [
"private",
"static",
"int",
"prepareCodeForToken",
"(",
"final",
"JBBPToken",
"token",
",",
"final",
"JBBPCustomFieldTypeProcessor",
"customTypeFieldProcessor",
")",
"{",
"int",
"result",
"=",
"-",
"1",
";",
"switch",
"(",
"token",
".",
"getType",
"(",
")",
")",
"{",
"case",
"ATOM",
":",
"{",
"final",
"JBBPFieldTypeParameterContainer",
"descriptor",
"=",
"token",
".",
"getFieldTypeParameters",
"(",
")",
";",
"result",
"=",
"descriptor",
".",
"getByteOrder",
"(",
")",
"==",
"JBBPByteOrder",
".",
"LITTLE_ENDIAN",
"?",
"FLAG_LITTLE_ENDIAN",
":",
"0",
";",
"final",
"boolean",
"hasExpressionAsExtraNumber",
"=",
"descriptor",
".",
"hasExpressionAsExtraData",
"(",
")",
";",
"result",
"|=",
"token",
".",
"getArraySizeAsString",
"(",
")",
"==",
"null",
"?",
"0",
":",
"(",
"token",
".",
"isVarArrayLength",
"(",
")",
"?",
"FLAG_ARRAY",
"|",
"FLAG_WIDE",
"|",
"(",
"EXT_FLAG_EXPRESSION_OR_WHOLESTREAM",
"<<",
"8",
")",
":",
"FLAG_ARRAY",
")",
";",
"result",
"|=",
"hasExpressionAsExtraNumber",
"?",
"FLAG_WIDE",
"|",
"(",
"EXT_FLAG_EXTRA_AS_EXPRESSION",
"<<",
"8",
")",
":",
"0",
";",
"result",
"|=",
"token",
".",
"getFieldTypeParameters",
"(",
")",
".",
"isSpecialField",
"(",
")",
"?",
"FLAG_WIDE",
"|",
"(",
"EXT_FLAG_EXTRA_DIFF_TYPE",
"<<",
"8",
")",
":",
"0",
";",
"result",
"|=",
"token",
".",
"getFieldName",
"(",
")",
"==",
"null",
"?",
"0",
":",
"FLAG_NAMED",
";",
"final",
"String",
"name",
"=",
"descriptor",
".",
"getTypeName",
"(",
")",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"switch",
"(",
"name",
")",
"{",
"case",
"\"skip\"",
":",
"case",
"\"val\"",
":",
"result",
"|=",
"CODE_SKIP",
";",
"break",
";",
"case",
"\"align\"",
":",
"result",
"|=",
"CODE_ALIGN",
";",
"break",
";",
"case",
"\"bit\"",
":",
"result",
"|=",
"CODE_BIT",
";",
"break",
";",
"case",
"\"var\"",
":",
"result",
"|=",
"CODE_VAR",
";",
"break",
";",
"case",
"\"bool\"",
":",
"case",
"JBBPFieldString",
".",
"TYPE_NAME",
":",
"result",
"|=",
"CODE_BOOL",
";",
"break",
";",
"case",
"\"ubyte\"",
":",
"result",
"|=",
"CODE_UBYTE",
";",
"break",
";",
"case",
"\"byte\"",
":",
"result",
"|=",
"CODE_BYTE",
";",
"break",
";",
"case",
"\"ushort\"",
":",
"result",
"|=",
"CODE_USHORT",
";",
"break",
";",
"case",
"\"short\"",
":",
"result",
"|=",
"CODE_SHORT",
";",
"break",
";",
"case",
"\"int\"",
":",
"case",
"JBBPFieldFloat",
".",
"TYPE_NAME",
":",
"result",
"|=",
"CODE_INT",
";",
"break",
";",
"case",
"\"long\"",
":",
"case",
"JBBPFieldDouble",
".",
"TYPE_NAME",
":",
"result",
"|=",
"CODE_LONG",
";",
"break",
";",
"case",
"\"reset$$\"",
":",
"result",
"|=",
"CODE_RESET_COUNTER",
";",
"break",
";",
"default",
":",
"boolean",
"unsupportedType",
"=",
"true",
";",
"if",
"(",
"customTypeFieldProcessor",
"!=",
"null",
")",
"{",
"for",
"(",
"final",
"String",
"s",
":",
"customTypeFieldProcessor",
".",
"getCustomFieldTypes",
"(",
")",
")",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"s",
")",
")",
"{",
"result",
"|=",
"CODE_CUSTOMTYPE",
";",
"unsupportedType",
"=",
"false",
";",
"break",
";",
"}",
"}",
"}",
"if",
"(",
"unsupportedType",
")",
"{",
"throw",
"new",
"JBBPCompilationException",
"(",
"\"Unsupported type [\"",
"+",
"descriptor",
".",
"getTypeName",
"(",
")",
"+",
"'",
"'",
",",
"token",
")",
";",
"}",
"break",
";",
"}",
"}",
"break",
";",
"case",
"COMMENT",
":",
"{",
"// doesn't contain code",
"}",
"break",
";",
"case",
"STRUCT_START",
":",
"{",
"result",
"=",
"token",
".",
"getArraySizeAsString",
"(",
")",
"==",
"null",
"?",
"0",
":",
"(",
"token",
".",
"isVarArrayLength",
"(",
")",
"?",
"FLAG_ARRAY",
"|",
"FLAG_WIDE",
"|",
"(",
"EXT_FLAG_EXPRESSION_OR_WHOLESTREAM",
"<<",
"8",
")",
":",
"FLAG_ARRAY",
")",
";",
"result",
"|=",
"token",
".",
"getFieldName",
"(",
")",
"==",
"null",
"?",
"0",
":",
"FLAG_NAMED",
";",
"result",
"|=",
"CODE_STRUCT_START",
";",
"}",
"break",
";",
"case",
"STRUCT_END",
":",
"{",
"result",
"=",
"CODE_STRUCT_END",
";",
"}",
"break",
";",
"default",
":",
"throw",
"new",
"Error",
"(",
"\"Unsupported type detected, contact developer! [\"",
"+",
"token",
".",
"getType",
"(",
")",
"+",
"'",
"'",
")",
";",
"}",
"return",
"result",
";",
"}"
] | The Method prepares a byte-code for a token field type and modifiers.
@param token a token to be processed, must not be null
@param customTypeFieldProcessor custom type field processor for the parser,
it can be null
@return the prepared byte code for the token | [
"The",
"Method",
"prepares",
"a",
"byte",
"-",
"code",
"for",
"a",
"token",
"field",
"type",
"and",
"modifiers",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiler.java#L543-L636 |
141,949 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/JBBPMapper.java | JBBPMapper.convertFieldValueToString | private static String convertFieldValueToString(final JBBPAbstractArrayField<?> field) {
final StringBuilder result;
if (field instanceof JBBPFieldArrayBit) {
final JBBPFieldArrayBit array = (JBBPFieldArrayBit) field;
result = new StringBuilder(array.size());
for (final byte b : array.getArray()) {
result.append((char) (b & 0xFF));
}
} else if (field instanceof JBBPFieldArrayByte) {
final JBBPFieldArrayByte array = (JBBPFieldArrayByte) field;
result = new StringBuilder(array.size());
for (final byte b : array.getArray()) {
result.append((char) (b & 0xFF));
}
} else if (field instanceof JBBPFieldArrayUByte) {
final JBBPFieldArrayUByte array = (JBBPFieldArrayUByte) field;
result = new StringBuilder(array.size());
for (final byte b : array.getArray()) {
result.append((char) (b & 0xFF));
}
} else if (field instanceof JBBPFieldArrayShort) {
final JBBPFieldArrayShort array = (JBBPFieldArrayShort) field;
result = new StringBuilder(array.size());
for (final short b : array.getArray()) {
result.append((char) b);
}
} else if (field instanceof JBBPFieldArrayUShort) {
final JBBPFieldArrayUShort array = (JBBPFieldArrayUShort) field;
result = new StringBuilder(array.size());
for (final short b : array.getArray()) {
result.append((char) b);
}
} else {
result = null;
}
return result == null ? null : result.toString();
} | java | private static String convertFieldValueToString(final JBBPAbstractArrayField<?> field) {
final StringBuilder result;
if (field instanceof JBBPFieldArrayBit) {
final JBBPFieldArrayBit array = (JBBPFieldArrayBit) field;
result = new StringBuilder(array.size());
for (final byte b : array.getArray()) {
result.append((char) (b & 0xFF));
}
} else if (field instanceof JBBPFieldArrayByte) {
final JBBPFieldArrayByte array = (JBBPFieldArrayByte) field;
result = new StringBuilder(array.size());
for (final byte b : array.getArray()) {
result.append((char) (b & 0xFF));
}
} else if (field instanceof JBBPFieldArrayUByte) {
final JBBPFieldArrayUByte array = (JBBPFieldArrayUByte) field;
result = new StringBuilder(array.size());
for (final byte b : array.getArray()) {
result.append((char) (b & 0xFF));
}
} else if (field instanceof JBBPFieldArrayShort) {
final JBBPFieldArrayShort array = (JBBPFieldArrayShort) field;
result = new StringBuilder(array.size());
for (final short b : array.getArray()) {
result.append((char) b);
}
} else if (field instanceof JBBPFieldArrayUShort) {
final JBBPFieldArrayUShort array = (JBBPFieldArrayUShort) field;
result = new StringBuilder(array.size());
for (final short b : array.getArray()) {
result.append((char) b);
}
} else {
result = null;
}
return result == null ? null : result.toString();
} | [
"private",
"static",
"String",
"convertFieldValueToString",
"(",
"final",
"JBBPAbstractArrayField",
"<",
"?",
">",
"field",
")",
"{",
"final",
"StringBuilder",
"result",
";",
"if",
"(",
"field",
"instanceof",
"JBBPFieldArrayBit",
")",
"{",
"final",
"JBBPFieldArrayBit",
"array",
"=",
"(",
"JBBPFieldArrayBit",
")",
"field",
";",
"result",
"=",
"new",
"StringBuilder",
"(",
"array",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"final",
"byte",
"b",
":",
"array",
".",
"getArray",
"(",
")",
")",
"{",
"result",
".",
"append",
"(",
"(",
"char",
")",
"(",
"b",
"&",
"0xFF",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"field",
"instanceof",
"JBBPFieldArrayByte",
")",
"{",
"final",
"JBBPFieldArrayByte",
"array",
"=",
"(",
"JBBPFieldArrayByte",
")",
"field",
";",
"result",
"=",
"new",
"StringBuilder",
"(",
"array",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"final",
"byte",
"b",
":",
"array",
".",
"getArray",
"(",
")",
")",
"{",
"result",
".",
"append",
"(",
"(",
"char",
")",
"(",
"b",
"&",
"0xFF",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"field",
"instanceof",
"JBBPFieldArrayUByte",
")",
"{",
"final",
"JBBPFieldArrayUByte",
"array",
"=",
"(",
"JBBPFieldArrayUByte",
")",
"field",
";",
"result",
"=",
"new",
"StringBuilder",
"(",
"array",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"final",
"byte",
"b",
":",
"array",
".",
"getArray",
"(",
")",
")",
"{",
"result",
".",
"append",
"(",
"(",
"char",
")",
"(",
"b",
"&",
"0xFF",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"field",
"instanceof",
"JBBPFieldArrayShort",
")",
"{",
"final",
"JBBPFieldArrayShort",
"array",
"=",
"(",
"JBBPFieldArrayShort",
")",
"field",
";",
"result",
"=",
"new",
"StringBuilder",
"(",
"array",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"final",
"short",
"b",
":",
"array",
".",
"getArray",
"(",
")",
")",
"{",
"result",
".",
"append",
"(",
"(",
"char",
")",
"b",
")",
";",
"}",
"}",
"else",
"if",
"(",
"field",
"instanceof",
"JBBPFieldArrayUShort",
")",
"{",
"final",
"JBBPFieldArrayUShort",
"array",
"=",
"(",
"JBBPFieldArrayUShort",
")",
"field",
";",
"result",
"=",
"new",
"StringBuilder",
"(",
"array",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"final",
"short",
"b",
":",
"array",
".",
"getArray",
"(",
")",
")",
"{",
"result",
".",
"append",
"(",
"(",
"char",
")",
"b",
")",
";",
"}",
"}",
"else",
"{",
"result",
"=",
"null",
";",
"}",
"return",
"result",
"==",
"null",
"?",
"null",
":",
"result",
".",
"toString",
"(",
")",
";",
"}"
] | Convert an array field into its string representation.
@param field an array field to be converted, must not be null
@return the string representation of the array or null if the field can't
be converted | [
"Convert",
"an",
"array",
"field",
"into",
"its",
"string",
"representation",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/JBBPMapper.java#L423-L459 |
141,950 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/JBBPMapper.java | JBBPMapper.setFieldValue | private static void setFieldValue(final Object classInstance, final Field classField, final JBBPAbstractField binField, final Object value) {
try {
classField.set(classInstance, value);
} catch (IllegalArgumentException ex) {
throw new JBBPMapperException("Can't set value to a mapping field", binField, classInstance.getClass(), classField, ex);
} catch (IllegalAccessException ex) {
throw new JBBPMapperException("Can't get access to a mapping field", binField, classInstance.getClass(), classField, ex);
}
} | java | private static void setFieldValue(final Object classInstance, final Field classField, final JBBPAbstractField binField, final Object value) {
try {
classField.set(classInstance, value);
} catch (IllegalArgumentException ex) {
throw new JBBPMapperException("Can't set value to a mapping field", binField, classInstance.getClass(), classField, ex);
} catch (IllegalAccessException ex) {
throw new JBBPMapperException("Can't get access to a mapping field", binField, classInstance.getClass(), classField, ex);
}
} | [
"private",
"static",
"void",
"setFieldValue",
"(",
"final",
"Object",
"classInstance",
",",
"final",
"Field",
"classField",
",",
"final",
"JBBPAbstractField",
"binField",
",",
"final",
"Object",
"value",
")",
"{",
"try",
"{",
"classField",
".",
"set",
"(",
"classInstance",
",",
"value",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"ex",
")",
"{",
"throw",
"new",
"JBBPMapperException",
"(",
"\"Can't set value to a mapping field\"",
",",
"binField",
",",
"classInstance",
".",
"getClass",
"(",
")",
",",
"classField",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"ex",
")",
"{",
"throw",
"new",
"JBBPMapperException",
"(",
"\"Can't get access to a mapping field\"",
",",
"binField",
",",
"classInstance",
".",
"getClass",
"(",
")",
",",
"classField",
",",
"ex",
")",
";",
"}",
"}"
] | Set a value to a field of a class instance. Can't be used for static
fields!
@param classInstance a class instance
@param classField a mapping class field which should be set by the value,
must not be null
@param binField a parsed bin field which value will be set, can be null
@param value a value to be set to the class field | [
"Set",
"a",
"value",
"to",
"a",
"field",
"of",
"a",
"class",
"instance",
".",
"Can",
"t",
"be",
"used",
"for",
"static",
"fields!"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/JBBPMapper.java#L471-L479 |
141,951 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/JBBPMapper.java | JBBPMapper.getFieldValue | private static Object getFieldValue(final Object classInstance, final Field classField) {
try {
return classField.get(classInstance);
} catch (IllegalArgumentException ex) {
throw new JBBPMapperException("Can't set get value from a mapping field", null, classInstance.getClass(), classField, ex);
} catch (IllegalAccessException ex) {
throw new JBBPMapperException("Can't get access to a mapping field", null, classInstance.getClass(), classField, ex);
}
} | java | private static Object getFieldValue(final Object classInstance, final Field classField) {
try {
return classField.get(classInstance);
} catch (IllegalArgumentException ex) {
throw new JBBPMapperException("Can't set get value from a mapping field", null, classInstance.getClass(), classField, ex);
} catch (IllegalAccessException ex) {
throw new JBBPMapperException("Can't get access to a mapping field", null, classInstance.getClass(), classField, ex);
}
} | [
"private",
"static",
"Object",
"getFieldValue",
"(",
"final",
"Object",
"classInstance",
",",
"final",
"Field",
"classField",
")",
"{",
"try",
"{",
"return",
"classField",
".",
"get",
"(",
"classInstance",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"ex",
")",
"{",
"throw",
"new",
"JBBPMapperException",
"(",
"\"Can't set get value from a mapping field\"",
",",
"null",
",",
"classInstance",
".",
"getClass",
"(",
")",
",",
"classField",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"ex",
")",
"{",
"throw",
"new",
"JBBPMapperException",
"(",
"\"Can't get access to a mapping field\"",
",",
"null",
",",
"classInstance",
".",
"getClass",
"(",
")",
",",
"classField",
",",
"ex",
")",
";",
"}",
"}"
] | Get a value of a field from a class instance.
@param classInstance a class instance object
@param classField a class field which value must be returned, must not be
null
@return the field value for the class instance | [
"Get",
"a",
"value",
"of",
"a",
"field",
"from",
"a",
"class",
"instance",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/JBBPMapper.java#L489-L497 |
141,952 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/JBBPMapper.java | JBBPMapper.mapArrayField | private static void mapArrayField(final Object mappingClassInstance, final Field mappingField, final JBBPAbstractArrayField<?> arrayField, final boolean invertBitOrder) {
try {
if (arrayField instanceof JBBPFieldArrayLong && mappingField.getType().getComponentType() == double.class) {
final long[] longarray = (long[]) arrayField.getValueArrayAsObject(invertBitOrder);
final double[] doublearray = new double[longarray.length];
for (int i = 0; i < longarray.length; i++) {
doublearray[i] = Double.longBitsToDouble(longarray[i]);
}
mappingField.set(mappingClassInstance, doublearray);
} else if (arrayField instanceof JBBPFieldArrayInt && mappingField.getType().getComponentType() == float.class) {
final int[] intarray = (int[]) arrayField.getValueArrayAsObject(invertBitOrder);
final float[] floatarray = new float[intarray.length];
for (int i = 0; i < intarray.length; i++) {
floatarray[i] = Float.intBitsToFloat(intarray[i]);
}
mappingField.set(mappingClassInstance, floatarray);
} else if (arrayField instanceof JBBPFieldArrayUShort && mappingField.getType().getComponentType() == char.class) {
final short[] shortarray = (short[]) arrayField.getValueArrayAsObject(invertBitOrder);
final char[] chararray = new char[shortarray.length];
for (int i = 0; i < shortarray.length; i++) {
chararray[i] = (char) shortarray[i];
}
mappingField.set(mappingClassInstance, chararray);
} else {
mappingField.set(mappingClassInstance, arrayField.getValueArrayAsObject(invertBitOrder));
}
} catch (IllegalAccessException ex) {
throw new JBBPMapperException("Can't get access to a mapping field", arrayField, mappingClassInstance.getClass(), mappingField, ex);
} catch (IllegalArgumentException ex) {
throw new JBBPMapperException("Can't set argument to a mapping field", arrayField, mappingClassInstance.getClass(), mappingField, ex);
}
} | java | private static void mapArrayField(final Object mappingClassInstance, final Field mappingField, final JBBPAbstractArrayField<?> arrayField, final boolean invertBitOrder) {
try {
if (arrayField instanceof JBBPFieldArrayLong && mappingField.getType().getComponentType() == double.class) {
final long[] longarray = (long[]) arrayField.getValueArrayAsObject(invertBitOrder);
final double[] doublearray = new double[longarray.length];
for (int i = 0; i < longarray.length; i++) {
doublearray[i] = Double.longBitsToDouble(longarray[i]);
}
mappingField.set(mappingClassInstance, doublearray);
} else if (arrayField instanceof JBBPFieldArrayInt && mappingField.getType().getComponentType() == float.class) {
final int[] intarray = (int[]) arrayField.getValueArrayAsObject(invertBitOrder);
final float[] floatarray = new float[intarray.length];
for (int i = 0; i < intarray.length; i++) {
floatarray[i] = Float.intBitsToFloat(intarray[i]);
}
mappingField.set(mappingClassInstance, floatarray);
} else if (arrayField instanceof JBBPFieldArrayUShort && mappingField.getType().getComponentType() == char.class) {
final short[] shortarray = (short[]) arrayField.getValueArrayAsObject(invertBitOrder);
final char[] chararray = new char[shortarray.length];
for (int i = 0; i < shortarray.length; i++) {
chararray[i] = (char) shortarray[i];
}
mappingField.set(mappingClassInstance, chararray);
} else {
mappingField.set(mappingClassInstance, arrayField.getValueArrayAsObject(invertBitOrder));
}
} catch (IllegalAccessException ex) {
throw new JBBPMapperException("Can't get access to a mapping field", arrayField, mappingClassInstance.getClass(), mappingField, ex);
} catch (IllegalArgumentException ex) {
throw new JBBPMapperException("Can't set argument to a mapping field", arrayField, mappingClassInstance.getClass(), mappingField, ex);
}
} | [
"private",
"static",
"void",
"mapArrayField",
"(",
"final",
"Object",
"mappingClassInstance",
",",
"final",
"Field",
"mappingField",
",",
"final",
"JBBPAbstractArrayField",
"<",
"?",
">",
"arrayField",
",",
"final",
"boolean",
"invertBitOrder",
")",
"{",
"try",
"{",
"if",
"(",
"arrayField",
"instanceof",
"JBBPFieldArrayLong",
"&&",
"mappingField",
".",
"getType",
"(",
")",
".",
"getComponentType",
"(",
")",
"==",
"double",
".",
"class",
")",
"{",
"final",
"long",
"[",
"]",
"longarray",
"=",
"(",
"long",
"[",
"]",
")",
"arrayField",
".",
"getValueArrayAsObject",
"(",
"invertBitOrder",
")",
";",
"final",
"double",
"[",
"]",
"doublearray",
"=",
"new",
"double",
"[",
"longarray",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"longarray",
".",
"length",
";",
"i",
"++",
")",
"{",
"doublearray",
"[",
"i",
"]",
"=",
"Double",
".",
"longBitsToDouble",
"(",
"longarray",
"[",
"i",
"]",
")",
";",
"}",
"mappingField",
".",
"set",
"(",
"mappingClassInstance",
",",
"doublearray",
")",
";",
"}",
"else",
"if",
"(",
"arrayField",
"instanceof",
"JBBPFieldArrayInt",
"&&",
"mappingField",
".",
"getType",
"(",
")",
".",
"getComponentType",
"(",
")",
"==",
"float",
".",
"class",
")",
"{",
"final",
"int",
"[",
"]",
"intarray",
"=",
"(",
"int",
"[",
"]",
")",
"arrayField",
".",
"getValueArrayAsObject",
"(",
"invertBitOrder",
")",
";",
"final",
"float",
"[",
"]",
"floatarray",
"=",
"new",
"float",
"[",
"intarray",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"intarray",
".",
"length",
";",
"i",
"++",
")",
"{",
"floatarray",
"[",
"i",
"]",
"=",
"Float",
".",
"intBitsToFloat",
"(",
"intarray",
"[",
"i",
"]",
")",
";",
"}",
"mappingField",
".",
"set",
"(",
"mappingClassInstance",
",",
"floatarray",
")",
";",
"}",
"else",
"if",
"(",
"arrayField",
"instanceof",
"JBBPFieldArrayUShort",
"&&",
"mappingField",
".",
"getType",
"(",
")",
".",
"getComponentType",
"(",
")",
"==",
"char",
".",
"class",
")",
"{",
"final",
"short",
"[",
"]",
"shortarray",
"=",
"(",
"short",
"[",
"]",
")",
"arrayField",
".",
"getValueArrayAsObject",
"(",
"invertBitOrder",
")",
";",
"final",
"char",
"[",
"]",
"chararray",
"=",
"new",
"char",
"[",
"shortarray",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"shortarray",
".",
"length",
";",
"i",
"++",
")",
"{",
"chararray",
"[",
"i",
"]",
"=",
"(",
"char",
")",
"shortarray",
"[",
"i",
"]",
";",
"}",
"mappingField",
".",
"set",
"(",
"mappingClassInstance",
",",
"chararray",
")",
";",
"}",
"else",
"{",
"mappingField",
".",
"set",
"(",
"mappingClassInstance",
",",
"arrayField",
".",
"getValueArrayAsObject",
"(",
"invertBitOrder",
")",
")",
";",
"}",
"}",
"catch",
"(",
"IllegalAccessException",
"ex",
")",
"{",
"throw",
"new",
"JBBPMapperException",
"(",
"\"Can't get access to a mapping field\"",
",",
"arrayField",
",",
"mappingClassInstance",
".",
"getClass",
"(",
")",
",",
"mappingField",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"ex",
")",
"{",
"throw",
"new",
"JBBPMapperException",
"(",
"\"Can't set argument to a mapping field\"",
",",
"arrayField",
",",
"mappingClassInstance",
".",
"getClass",
"(",
")",
",",
"mappingField",
",",
"ex",
")",
";",
"}",
"}"
] | Map a parsed array to an array field in mapping class.
@param mappingClassInstance a mapping class instance, must not be null
@param mappingField a field in the mapping class to be set, must not be
null
@param arrayField a binary parsed array field, must not be null
@param invertBitOrder flag shows that values of an array must be bit
reversed before set | [
"Map",
"a",
"parsed",
"array",
"to",
"an",
"array",
"field",
"in",
"mapping",
"class",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/JBBPMapper.java#L557-L588 |
141,953 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/JBBPMapper.java | JBBPMapper.allocateMemoryForClass | private static <T> T allocateMemoryForClass(final JBBPFieldStruct root, final Class<T> klazz) {
try {
return CLASS_INSTANTIATOR.makeClassInstance(klazz);
} catch (InstantiationException ex) {
throw new JBBPMapperException("Can't make an instance of a class", root, klazz, null, ex);
}
} | java | private static <T> T allocateMemoryForClass(final JBBPFieldStruct root, final Class<T> klazz) {
try {
return CLASS_INSTANTIATOR.makeClassInstance(klazz);
} catch (InstantiationException ex) {
throw new JBBPMapperException("Can't make an instance of a class", root, klazz, null, ex);
}
} | [
"private",
"static",
"<",
"T",
">",
"T",
"allocateMemoryForClass",
"(",
"final",
"JBBPFieldStruct",
"root",
",",
"final",
"Class",
"<",
"T",
">",
"klazz",
")",
"{",
"try",
"{",
"return",
"CLASS_INSTANTIATOR",
".",
"makeClassInstance",
"(",
"klazz",
")",
";",
"}",
"catch",
"(",
"InstantiationException",
"ex",
")",
"{",
"throw",
"new",
"JBBPMapperException",
"(",
"\"Can't make an instance of a class\"",
",",
"root",
",",
"klazz",
",",
"null",
",",
"ex",
")",
";",
"}",
"}"
] | Makes an instance of a class without call of its constructor, just allocate
memory
@param <T> a class which instance is needed
@param root the structure to be mapped, it is needed as info for exception
@param klazz the class which instance is needed
@return an instance of the class without called constructor
@throws JBBPMapperException it will be thrown if it is impossible to make
an instance | [
"Makes",
"an",
"instance",
"of",
"a",
"class",
"without",
"call",
"of",
"its",
"constructor",
"just",
"allocate",
"memory"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/JBBPMapper.java#L601-L607 |
141,954 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/ReflectApiUtil.java | ReflectApiUtil.newInstance | public static <T> T newInstance(final Class<T> klazz) {
try {
return klazz.getConstructor().newInstance();
} catch (Exception ex) {
throw new Error(String.format("Can't create instance of %s for error %s", klazz.getCanonicalName(), ex.getMessage()), ex);
}
} | java | public static <T> T newInstance(final Class<T> klazz) {
try {
return klazz.getConstructor().newInstance();
} catch (Exception ex) {
throw new Error(String.format("Can't create instance of %s for error %s", klazz.getCanonicalName(), ex.getMessage()), ex);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"final",
"Class",
"<",
"T",
">",
"klazz",
")",
"{",
"try",
"{",
"return",
"klazz",
".",
"getConstructor",
"(",
")",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"Error",
"(",
"String",
".",
"format",
"(",
"\"Can't create instance of %s for error %s\"",
",",
"klazz",
".",
"getCanonicalName",
"(",
")",
",",
"ex",
".",
"getMessage",
"(",
")",
")",
",",
"ex",
")",
";",
"}",
"}"
] | Create class instance through default constructor call
@param klazz class to be instantiated, must not be null
@param <T> type of the class
@return instance of class, must not be null | [
"Create",
"class",
"instance",
"through",
"default",
"constructor",
"call"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/ReflectApiUtil.java#L53-L59 |
141,955 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/ReflectApiUtil.java | ReflectApiUtil.newInstanceForClassName | public static Object newInstanceForClassName(final String className) {
try {
return newInstance(Class.forName(className));
} catch (Exception ex) {
throw new Error(String.format("Can't create instance of %s for error %s", className, ex.getMessage()), ex);
}
} | java | public static Object newInstanceForClassName(final String className) {
try {
return newInstance(Class.forName(className));
} catch (Exception ex) {
throw new Error(String.format("Can't create instance of %s for error %s", className, ex.getMessage()), ex);
}
} | [
"public",
"static",
"Object",
"newInstanceForClassName",
"(",
"final",
"String",
"className",
")",
"{",
"try",
"{",
"return",
"newInstance",
"(",
"Class",
".",
"forName",
"(",
"className",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"Error",
"(",
"String",
".",
"format",
"(",
"\"Can't create instance of %s for error %s\"",
",",
"className",
",",
"ex",
".",
"getMessage",
"(",
")",
")",
",",
"ex",
")",
";",
"}",
"}"
] | Find class for name and make an instance through call of the default constructor.
@param className the class name to be instantiated, must not be null
@return new instance of the class, must not be null
@throws Error if it is impossible to build instance for an exception | [
"Find",
"class",
"for",
"name",
"and",
"make",
"an",
"instance",
"through",
"call",
"of",
"the",
"default",
"constructor",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/ReflectApiUtil.java#L68-L74 |
141,956 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/instantiators/JBBPSafeInstantiator.java | JBBPSafeInstantiator.makeStubForConstructor | private static Object[] makeStubForConstructor(final Class<?>[] constructorParamTypes) {
if (constructorParamTypes.length == 0) {
return EMPTY_OBJECT_ARRAY;
}
final Object[] result = new Object[constructorParamTypes.length];
for (int i = 0; i < constructorParamTypes.length; i++) {
final Class<?> arg = constructorParamTypes[i];
final Object obj;
if (arg.isArray()) {
obj = null;
} else {
if (arg == byte.class) {
obj = (byte) 0;
} else if (arg == char.class) {
obj = 'a';
} else if (arg == short.class) {
obj = (short) 0;
} else if (arg == boolean.class) {
obj = Boolean.FALSE;
} else if (arg == int.class) {
obj = 0;
} else if (arg == long.class) {
obj = 0L;
} else if (arg == double.class) {
obj = 0.0d;
} else if (arg == float.class) {
obj = 0.0f;
} else {
obj = null;
}
}
result[i] = obj;
}
return result;
} | java | private static Object[] makeStubForConstructor(final Class<?>[] constructorParamTypes) {
if (constructorParamTypes.length == 0) {
return EMPTY_OBJECT_ARRAY;
}
final Object[] result = new Object[constructorParamTypes.length];
for (int i = 0; i < constructorParamTypes.length; i++) {
final Class<?> arg = constructorParamTypes[i];
final Object obj;
if (arg.isArray()) {
obj = null;
} else {
if (arg == byte.class) {
obj = (byte) 0;
} else if (arg == char.class) {
obj = 'a';
} else if (arg == short.class) {
obj = (short) 0;
} else if (arg == boolean.class) {
obj = Boolean.FALSE;
} else if (arg == int.class) {
obj = 0;
} else if (arg == long.class) {
obj = 0L;
} else if (arg == double.class) {
obj = 0.0d;
} else if (arg == float.class) {
obj = 0.0f;
} else {
obj = null;
}
}
result[i] = obj;
}
return result;
} | [
"private",
"static",
"Object",
"[",
"]",
"makeStubForConstructor",
"(",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"constructorParamTypes",
")",
"{",
"if",
"(",
"constructorParamTypes",
".",
"length",
"==",
"0",
")",
"{",
"return",
"EMPTY_OBJECT_ARRAY",
";",
"}",
"final",
"Object",
"[",
"]",
"result",
"=",
"new",
"Object",
"[",
"constructorParamTypes",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"constructorParamTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"arg",
"=",
"constructorParamTypes",
"[",
"i",
"]",
";",
"final",
"Object",
"obj",
";",
"if",
"(",
"arg",
".",
"isArray",
"(",
")",
")",
"{",
"obj",
"=",
"null",
";",
"}",
"else",
"{",
"if",
"(",
"arg",
"==",
"byte",
".",
"class",
")",
"{",
"obj",
"=",
"(",
"byte",
")",
"0",
";",
"}",
"else",
"if",
"(",
"arg",
"==",
"char",
".",
"class",
")",
"{",
"obj",
"=",
"'",
"'",
";",
"}",
"else",
"if",
"(",
"arg",
"==",
"short",
".",
"class",
")",
"{",
"obj",
"=",
"(",
"short",
")",
"0",
";",
"}",
"else",
"if",
"(",
"arg",
"==",
"boolean",
".",
"class",
")",
"{",
"obj",
"=",
"Boolean",
".",
"FALSE",
";",
"}",
"else",
"if",
"(",
"arg",
"==",
"int",
".",
"class",
")",
"{",
"obj",
"=",
"0",
";",
"}",
"else",
"if",
"(",
"arg",
"==",
"long",
".",
"class",
")",
"{",
"obj",
"=",
"0L",
";",
"}",
"else",
"if",
"(",
"arg",
"==",
"double",
".",
"class",
")",
"{",
"obj",
"=",
"0.0d",
";",
"}",
"else",
"if",
"(",
"arg",
"==",
"float",
".",
"class",
")",
"{",
"obj",
"=",
"0.0f",
";",
"}",
"else",
"{",
"obj",
"=",
"null",
";",
"}",
"}",
"result",
"[",
"i",
"]",
"=",
"obj",
";",
"}",
"return",
"result",
";",
"}"
] | Make stub arguments for a constructor.
@param constructorParamTypes types of constructor arguments, must not be
null
@return generated Object array contains stub values for the constructor,
must not be null | [
"Make",
"stub",
"arguments",
"for",
"a",
"constructor",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/instantiators/JBBPSafeInstantiator.java#L55-L89 |
141,957 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/instantiators/JBBPSafeInstantiator.java | JBBPSafeInstantiator.findConstructorForInnerClass | private static Constructor<?> findConstructorForInnerClass(final Class<?> klazz, final Class<?> declaringClass) {
final Constructor<?>[] constructors = klazz.getDeclaredConstructors();
if (constructors.length == 1) {
return constructors[0];
}
for (final Constructor<?> c : constructors) {
final Class<?>[] params = c.getParameterTypes();
if (params.length == 1 && params[0] == declaringClass) {
return c;
}
}
return constructors[0];
} | java | private static Constructor<?> findConstructorForInnerClass(final Class<?> klazz, final Class<?> declaringClass) {
final Constructor<?>[] constructors = klazz.getDeclaredConstructors();
if (constructors.length == 1) {
return constructors[0];
}
for (final Constructor<?> c : constructors) {
final Class<?>[] params = c.getParameterTypes();
if (params.length == 1 && params[0] == declaringClass) {
return c;
}
}
return constructors[0];
} | [
"private",
"static",
"Constructor",
"<",
"?",
">",
"findConstructorForInnerClass",
"(",
"final",
"Class",
"<",
"?",
">",
"klazz",
",",
"final",
"Class",
"<",
"?",
">",
"declaringClass",
")",
"{",
"final",
"Constructor",
"<",
"?",
">",
"[",
"]",
"constructors",
"=",
"klazz",
".",
"getDeclaredConstructors",
"(",
")",
";",
"if",
"(",
"constructors",
".",
"length",
"==",
"1",
")",
"{",
"return",
"constructors",
"[",
"0",
"]",
";",
"}",
"for",
"(",
"final",
"Constructor",
"<",
"?",
">",
"c",
":",
"constructors",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"params",
"=",
"c",
".",
"getParameterTypes",
"(",
")",
";",
"if",
"(",
"params",
".",
"length",
"==",
"1",
"&&",
"params",
"[",
"0",
"]",
"==",
"declaringClass",
")",
"{",
"return",
"c",
";",
"}",
"}",
"return",
"constructors",
"[",
"0",
"]",
";",
"}"
] | Find a constructor for an inner class.
@param klazz a class to find a constructor, must not be null
@param declaringClass the declaring class for the class, must not be null
@return found constructor to be used to make an instance | [
"Find",
"a",
"constructor",
"for",
"an",
"inner",
"class",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/instantiators/JBBPSafeInstantiator.java#L98-L110 |
141,958 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/instantiators/JBBPSafeInstantiator.java | JBBPSafeInstantiator.findConstructorForStaticClass | private static Constructor<?> findConstructorForStaticClass(final Class<?> klazz) {
final Constructor<?>[] constructors = klazz.getDeclaredConstructors();
if (constructors.length == 1) {
return constructors[0];
}
for (final Constructor<?> c : constructors) {
final Class<?>[] params = c.getParameterTypes();
if (params.length == 0) {
return c;
}
}
return constructors[0];
} | java | private static Constructor<?> findConstructorForStaticClass(final Class<?> klazz) {
final Constructor<?>[] constructors = klazz.getDeclaredConstructors();
if (constructors.length == 1) {
return constructors[0];
}
for (final Constructor<?> c : constructors) {
final Class<?>[] params = c.getParameterTypes();
if (params.length == 0) {
return c;
}
}
return constructors[0];
} | [
"private",
"static",
"Constructor",
"<",
"?",
">",
"findConstructorForStaticClass",
"(",
"final",
"Class",
"<",
"?",
">",
"klazz",
")",
"{",
"final",
"Constructor",
"<",
"?",
">",
"[",
"]",
"constructors",
"=",
"klazz",
".",
"getDeclaredConstructors",
"(",
")",
";",
"if",
"(",
"constructors",
".",
"length",
"==",
"1",
")",
"{",
"return",
"constructors",
"[",
"0",
"]",
";",
"}",
"for",
"(",
"final",
"Constructor",
"<",
"?",
">",
"c",
":",
"constructors",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"params",
"=",
"c",
".",
"getParameterTypes",
"(",
")",
";",
"if",
"(",
"params",
".",
"length",
"==",
"0",
")",
"{",
"return",
"c",
";",
"}",
"}",
"return",
"constructors",
"[",
"0",
"]",
";",
"}"
] | Find a constructor for a static class.
@param klazz a class to find a constructor, must not be null
@return found constructor to be used to make an instance | [
"Find",
"a",
"constructor",
"for",
"a",
"static",
"class",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/instantiators/JBBPSafeInstantiator.java#L118-L130 |
141,959 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Custom | public JBBPDslBuilder Custom(final String type, final String name) {
return this.Custom(type, name, null);
} | java | public JBBPDslBuilder Custom(final String type, final String name) {
return this.Custom(type, name, null);
} | [
"public",
"JBBPDslBuilder",
"Custom",
"(",
"final",
"String",
"type",
",",
"final",
"String",
"name",
")",
"{",
"return",
"this",
".",
"Custom",
"(",
"type",
",",
"name",
",",
"null",
")",
";",
"}"
] | Add named custom variable.
@param type custom type, must not be null
@param name name of the field, can be null for anonymous
@return the builder instance, must not be null | [
"Add",
"named",
"custom",
"variable",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L298-L300 |
141,960 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Custom | public JBBPDslBuilder Custom(final String type, final String name, final String param) {
final ItemCustom custom = new ItemCustom(type, name, this.byteOrder);
custom.bitLenExpression = param == null ? null : assertExpressionChars(param);
this.addItem(custom);
return this;
} | java | public JBBPDslBuilder Custom(final String type, final String name, final String param) {
final ItemCustom custom = new ItemCustom(type, name, this.byteOrder);
custom.bitLenExpression = param == null ? null : assertExpressionChars(param);
this.addItem(custom);
return this;
} | [
"public",
"JBBPDslBuilder",
"Custom",
"(",
"final",
"String",
"type",
",",
"final",
"String",
"name",
",",
"final",
"String",
"param",
")",
"{",
"final",
"ItemCustom",
"custom",
"=",
"new",
"ItemCustom",
"(",
"type",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"custom",
".",
"bitLenExpression",
"=",
"param",
"==",
"null",
"?",
"null",
":",
"assertExpressionChars",
"(",
"param",
")",
";",
"this",
".",
"addItem",
"(",
"custom",
")",
";",
"return",
"this",
";",
"}"
] | Add named parametric custom variable.
@param type custom type, must not be null
@param name name of the field, can be null for anonymous
@param param optional parameter for the field, can be null
@return the builder instance, must not be null | [
"Add",
"named",
"parametric",
"custom",
"variable",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L310-L315 |
141,961 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Struct | public JBBPDslBuilder Struct(final String name) {
final Item item = new Item(BinType.STRUCT, name, this.byteOrder);
this.addItem(item);
this.openedStructCounter++;
return this;
} | java | public JBBPDslBuilder Struct(final String name) {
final Item item = new Item(BinType.STRUCT, name, this.byteOrder);
this.addItem(item);
this.openedStructCounter++;
return this;
} | [
"public",
"JBBPDslBuilder",
"Struct",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"STRUCT",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"this",
".",
"openedStructCounter",
"++",
";",
"return",
"this",
";",
"}"
] | Create new named struct.
@param name name of structure, it can be null for anonymous one
@return the builder instance, must not be null | [
"Create",
"new",
"named",
"struct",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L332-L337 |
141,962 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.StructArray | public JBBPDslBuilder StructArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.STRUCT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
this.openedStructCounter++;
return this;
} | java | public JBBPDslBuilder StructArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.STRUCT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
this.openedStructCounter++;
return this;
} | [
"public",
"JBBPDslBuilder",
"StructArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"STRUCT_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"this",
".",
"openedStructCounter",
"++",
";",
"return",
"this",
";",
"}"
] | Create named structure array which size calculated by expression.
@param name name of the structure array, can be null for anonymous one
@param sizeExpression expression to calculate array length, must not be null.
@return the builder instance, must not be null | [
"Create",
"named",
"structure",
"array",
"which",
"size",
"calculated",
"by",
"expression",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L377-L383 |
141,963 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Val | public JBBPDslBuilder Val(final String name, final String expression) {
final Item item = new ItemVal(
assertTextNotNullAndTrimmedNotEmpty(name),
assertExpressionChars(assertTextNotNullAndTrimmedNotEmpty(expression)).trim()
);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder Val(final String name, final String expression) {
final Item item = new ItemVal(
assertTextNotNullAndTrimmedNotEmpty(name),
assertExpressionChars(assertTextNotNullAndTrimmedNotEmpty(expression)).trim()
);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"Val",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"expression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"ItemVal",
"(",
"assertTextNotNullAndTrimmedNotEmpty",
"(",
"name",
")",
",",
"assertExpressionChars",
"(",
"assertTextNotNullAndTrimmedNotEmpty",
"(",
"expression",
")",
")",
".",
"trim",
"(",
")",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add virtual field which not be read but its value will be calculated by expression
@param name name of the value, it must not be null or empty
@param expression expression to calculate value, it must not be null or empty
@return the builder instance, must not be null | [
"Add",
"virtual",
"field",
"which",
"not",
"be",
"read",
"but",
"its",
"value",
"will",
"be",
"calculated",
"by",
"expression"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L392-L399 |
141,964 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.CustomArray | public JBBPDslBuilder CustomArray(final String type, final String size) {
return this.CustomArray(type, null, size, null);
} | java | public JBBPDslBuilder CustomArray(final String type, final String size) {
return this.CustomArray(type, null, size, null);
} | [
"public",
"JBBPDslBuilder",
"CustomArray",
"(",
"final",
"String",
"type",
",",
"final",
"String",
"size",
")",
"{",
"return",
"this",
".",
"CustomArray",
"(",
"type",
",",
"null",
",",
"size",
",",
"null",
")",
";",
"}"
] | Create anonymous custom type array with fixed size.
@param type custom type, must not be null
@param size expression to calculate size of the array, must not be null.
@return the builder instance, must not be null | [
"Create",
"anonymous",
"custom",
"type",
"array",
"with",
"fixed",
"size",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L496-L498 |
141,965 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.CloseStruct | public JBBPDslBuilder CloseStruct(final boolean closeAllOpened) {
if (this.openedStructCounter == 0) {
throw new IllegalStateException("There is not any opened struct");
}
this.addItem(new ItemStructEnd(closeAllOpened));
this.openedStructCounter = closeAllOpened ? 0 : this.openedStructCounter - 1;
return this;
} | java | public JBBPDslBuilder CloseStruct(final boolean closeAllOpened) {
if (this.openedStructCounter == 0) {
throw new IllegalStateException("There is not any opened struct");
}
this.addItem(new ItemStructEnd(closeAllOpened));
this.openedStructCounter = closeAllOpened ? 0 : this.openedStructCounter - 1;
return this;
} | [
"public",
"JBBPDslBuilder",
"CloseStruct",
"(",
"final",
"boolean",
"closeAllOpened",
")",
"{",
"if",
"(",
"this",
".",
"openedStructCounter",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"There is not any opened struct\"",
")",
";",
"}",
"this",
".",
"addItem",
"(",
"new",
"ItemStructEnd",
"(",
"closeAllOpened",
")",
")",
";",
"this",
".",
"openedStructCounter",
"=",
"closeAllOpened",
"?",
"0",
":",
"this",
".",
"openedStructCounter",
"-",
"1",
";",
"return",
"this",
";",
"}"
] | Add directive to close currently opened structure or all opened structures.
@param closeAllOpened flag to close all opened structures if true, false if close only last opened structure
@return the builder instance, must not be null
@throws IllegalStateException if there is not any opened struct | [
"Add",
"directive",
"to",
"close",
"currently",
"opened",
"structure",
"or",
"all",
"opened",
"structures",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L572-L579 |
141,966 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Bits | public JBBPDslBuilder Bits(final String name, final JBBPBitNumber bits) {
final Item item = new Item(BinType.BIT, name, this.byteOrder);
item.bitNumber = bits;
this.addItem(item);
return this;
} | java | public JBBPDslBuilder Bits(final String name, final JBBPBitNumber bits) {
final Item item = new Item(BinType.BIT, name, this.byteOrder);
item.bitNumber = bits;
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"Bits",
"(",
"final",
"String",
"name",
",",
"final",
"JBBPBitNumber",
"bits",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"BIT",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"bitNumber",
"=",
"bits",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named fixed length bit field.
@param name name of the field, if null then anonymous one
@param bits number of bits as length of the field, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"fixed",
"length",
"bit",
"field",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L636-L641 |
141,967 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Bits | public JBBPDslBuilder Bits(final String name, final String bitLenExpression) {
final Item item = new Item(BinType.BIT, name, this.byteOrder);
item.bitLenExpression = assertExpressionChars(bitLenExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder Bits(final String name, final String bitLenExpression) {
final Item item = new Item(BinType.BIT, name, this.byteOrder);
item.bitLenExpression = assertExpressionChars(bitLenExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"Bits",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"bitLenExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"BIT",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"bitLenExpression",
"=",
"assertExpressionChars",
"(",
"bitLenExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named bit field which length calculated by expression.
@param name name of the field, if null then anonymous one
@param bitLenExpression expression to calculate number of bits, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"bit",
"field",
"which",
"length",
"calculated",
"by",
"expression",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L650-L655 |
141,968 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.BitArray | public JBBPDslBuilder BitArray(final JBBPBitNumber bits, final int size) {
return this.BitArray(null, bits, arraySizeToString(size));
} | java | public JBBPDslBuilder BitArray(final JBBPBitNumber bits, final int size) {
return this.BitArray(null, bits, arraySizeToString(size));
} | [
"public",
"JBBPDslBuilder",
"BitArray",
"(",
"final",
"JBBPBitNumber",
"bits",
",",
"final",
"int",
"size",
")",
"{",
"return",
"this",
".",
"BitArray",
"(",
"null",
",",
"bits",
",",
"arraySizeToString",
"(",
"size",
")",
")",
";",
"}"
] | Add anonymous fixed length bit array.
@param bits length of the field, must not be null
@param size number of elements in array, if negative then till the end of stream
@return the builder instance, must not be null | [
"Add",
"anonymous",
"fixed",
"length",
"bit",
"array",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L664-L666 |
141,969 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.BitArray | public JBBPDslBuilder BitArray(final String name, final JBBPBitNumber bits, final int size) {
return this.BitArray(name, bits, arraySizeToString(size));
} | java | public JBBPDslBuilder BitArray(final String name, final JBBPBitNumber bits, final int size) {
return this.BitArray(name, bits, arraySizeToString(size));
} | [
"public",
"JBBPDslBuilder",
"BitArray",
"(",
"final",
"String",
"name",
",",
"final",
"JBBPBitNumber",
"bits",
",",
"final",
"int",
"size",
")",
"{",
"return",
"this",
".",
"BitArray",
"(",
"name",
",",
"bits",
",",
"arraySizeToString",
"(",
"size",
")",
")",
";",
"}"
] | Add named fixed length bit array.
@param name name of the array, if null then anonymous one
@param bits length of the field, must not be null
@param size number of elements in array, if negative then till the end of stream
@return the builder instance, must not be null | [
"Add",
"named",
"fixed",
"length",
"bit",
"array",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L676-L678 |
141,970 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.BitArray | public JBBPDslBuilder BitArray(final String name, final String bitLenExpression, final int size) {
return this.BitArray(name, bitLenExpression, arraySizeToString(size));
} | java | public JBBPDslBuilder BitArray(final String name, final String bitLenExpression, final int size) {
return this.BitArray(name, bitLenExpression, arraySizeToString(size));
} | [
"public",
"JBBPDslBuilder",
"BitArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"bitLenExpression",
",",
"final",
"int",
"size",
")",
"{",
"return",
"this",
".",
"BitArray",
"(",
"name",
",",
"bitLenExpression",
",",
"arraySizeToString",
"(",
"size",
")",
")",
";",
"}"
] | Add named fixed length bit array, size of one bit field is calculated by expression.
@param name name of the array, if null then anonymous one
@param bitLenExpression expression to calculate length of the bit field, must not be null
@param size number of elements in array, if negative then till the end of stream
@return the builder instance, must not be null | [
"Add",
"named",
"fixed",
"length",
"bit",
"array",
"size",
"of",
"one",
"bit",
"field",
"is",
"calculated",
"by",
"expression",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L688-L690 |
141,971 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.BitArray | public JBBPDslBuilder BitArray(final String name, final JBBPBitNumber bits, final String sizeExpression) {
final Item item = new Item(BinType.BIT_ARRAY, name, this.byteOrder);
item.bitNumber = bits;
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder BitArray(final String name, final JBBPBitNumber bits, final String sizeExpression) {
final Item item = new Item(BinType.BIT_ARRAY, name, this.byteOrder);
item.bitNumber = bits;
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"BitArray",
"(",
"final",
"String",
"name",
",",
"final",
"JBBPBitNumber",
"bits",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"BIT_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"bitNumber",
"=",
"bits",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named bit array with size calculated through expression.
@param name name of the array, if null then anonymous one
@param bits length of the field, must not be null
@param sizeExpression expression to be used to calculate array size, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"bit",
"array",
"with",
"size",
"calculated",
"through",
"expression",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L722-L728 |
141,972 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.BitArray | public JBBPDslBuilder BitArray(final String name, final String bitLenExpression, final String sizeExpression) {
final Item item = new Item(BinType.BIT_ARRAY, name, this.byteOrder);
item.bitLenExpression = assertExpressionChars(bitLenExpression);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder BitArray(final String name, final String bitLenExpression, final String sizeExpression) {
final Item item = new Item(BinType.BIT_ARRAY, name, this.byteOrder);
item.bitLenExpression = assertExpressionChars(bitLenExpression);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"BitArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"bitLenExpression",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"BIT_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"bitLenExpression",
"=",
"assertExpressionChars",
"(",
"bitLenExpression",
")",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named bit array where each bit length is calculated through expression.
@param name name of the array, if null then anonymous one
@param bitLenExpression expression to calculate length of the bit field, must not be null
@param sizeExpression expression to be used to calculate array size, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"bit",
"array",
"where",
"each",
"bit",
"length",
"is",
"calculated",
"through",
"expression",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L738-L744 |
141,973 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.BoolArray | public JBBPDslBuilder BoolArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.BOOL_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder BoolArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.BOOL_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"BoolArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"BOOL_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named boolean array which length calculated through expression.
@param name name of the array, it can be null for anonymous one
@param sizeExpression expression to calculate number of elements, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"boolean",
"array",
"which",
"length",
"calculated",
"through",
"expression",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L784-L789 |
141,974 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Bool | public JBBPDslBuilder Bool(final String name) {
final Item item = new Item(BinType.BOOL, name, this.byteOrder);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder Bool(final String name) {
final Item item = new Item(BinType.BOOL, name, this.byteOrder);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"Bool",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"BOOL",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named boolean field.
@param name name of the field, can be null for anonymous one
@return the builder instance, must not be null | [
"Add",
"named",
"boolean",
"field",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L806-L810 |
141,975 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Byte | public JBBPDslBuilder Byte(final String name) {
final Item item = new Item(BinType.BYTE, name, this.byteOrder);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder Byte(final String name) {
final Item item = new Item(BinType.BYTE, name, this.byteOrder);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"Byte",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"BYTE",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named signed byte field.
@param name name of the field, can be null for anonymous one
@return the builder instance, must not be null | [
"Add",
"named",
"signed",
"byte",
"field",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L827-L831 |
141,976 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.ByteArray | public JBBPDslBuilder ByteArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.BYTE_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder ByteArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.BYTE_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"ByteArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"BYTE_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named byte array which size calculated through expression.
@param name name of the array, it can be null for anonymous fields
@param sizeExpression expression to be used to calculate array length, must not be null or empty.
@return the builder instance, must not be null | [
"Add",
"named",
"byte",
"array",
"which",
"size",
"calculated",
"through",
"expression",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L871-L876 |
141,977 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.UByte | public JBBPDslBuilder UByte(final String name) {
final Item item = new Item(BinType.UBYTE, name, this.byteOrder);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder UByte(final String name) {
final Item item = new Item(BinType.UBYTE, name, this.byteOrder);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"UByte",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"UBYTE",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named unsigned byte field.
@param name name of the field, can be null for anonymous one
@return the builder instance, must not be null | [
"Add",
"named",
"unsigned",
"byte",
"field",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L893-L897 |
141,978 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.UByteArray | public JBBPDslBuilder UByteArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.UBYTE_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder UByteArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.UBYTE_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"UByteArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"UBYTE_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named unsigned byte array which size calculated through expression.
@param name name of the field, it can be null for anonymous one
@param sizeExpression expression to calculate array size, must ot be null or empty.
@return the builder instance, must not be null | [
"Add",
"named",
"unsigned",
"byte",
"array",
"which",
"size",
"calculated",
"through",
"expression",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L937-L942 |
141,979 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Short | public JBBPDslBuilder Short(final String name) {
final Item item = new Item(BinType.SHORT, name, this.byteOrder);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder Short(final String name) {
final Item item = new Item(BinType.SHORT, name, this.byteOrder);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"Short",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"SHORT",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named signed short field.
@param name name of the field, can be null for anonymous one
@return the builder instance, must not be null | [
"Add",
"named",
"signed",
"short",
"field",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L959-L963 |
141,980 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.ShortArray | public JBBPDslBuilder ShortArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.SHORT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder ShortArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.SHORT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"ShortArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"SHORT_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named fixed signed short array which size calculated through expression.
@param name name of the field, if null then anonymous
@param sizeExpression expression to be used to calculate size, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"fixed",
"signed",
"short",
"array",
"which",
"size",
"calculated",
"through",
"expression",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1003-L1008 |
141,981 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.UShort | public JBBPDslBuilder UShort(final String name) {
final Item item = new Item(BinType.USHORT, name, this.byteOrder);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder UShort(final String name) {
final Item item = new Item(BinType.USHORT, name, this.byteOrder);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"UShort",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"USHORT",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named unsigned short field.
@param name name of the field, can be null for anonymous
@return the builder instance, must not be null | [
"Add",
"named",
"unsigned",
"short",
"field",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1025-L1029 |
141,982 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.UShortArray | public JBBPDslBuilder UShortArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.USHORT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder UShortArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.USHORT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"UShortArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"USHORT_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named fixed unsigned short array which size calculated through expression.
@param name name of the field, if null then anonymous
@param sizeExpression expression to be used to calculate size, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"fixed",
"unsigned",
"short",
"array",
"which",
"size",
"calculated",
"through",
"expression",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1058-L1063 |
141,983 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Int | public JBBPDslBuilder Int(final String name) {
final Item item = new Item(BinType.INT, name, this.byteOrder);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder Int(final String name) {
final Item item = new Item(BinType.INT, name, this.byteOrder);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"Int",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"INT",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named integer field.
@param name name of the field, can be null for anonymous
@return the builder instance, must not be null | [
"Add",
"named",
"integer",
"field",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1091-L1095 |
141,984 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.IntArray | public JBBPDslBuilder IntArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.INT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder IntArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.INT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"IntArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"INT_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named integer array with size calculated through expression.
@param name name of field, can be nul for anonymous
@param sizeExpression expression to be used to calculate size, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"integer",
"array",
"with",
"size",
"calculated",
"through",
"expression",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1135-L1140 |
141,985 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Long | public JBBPDslBuilder Long(final String name) {
final Item item = new Item(BinType.LONG, name, this.byteOrder);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder Long(final String name) {
final Item item = new Item(BinType.LONG, name, this.byteOrder);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"Long",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"LONG",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named long field.
@param name name of the field, can be null for anonymous
@return the builder instance, must not be null | [
"Add",
"named",
"long",
"field",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1157-L1161 |
141,986 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.LongArray | public JBBPDslBuilder LongArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.LONG_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder LongArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.LONG_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"LongArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"LONG_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named long array which size calculated through expression.
@param name name of the field, can be null for anonymous
@param sizeExpression expression to be used to calculate size, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"long",
"array",
"which",
"size",
"calculated",
"through",
"expression",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1201-L1206 |
141,987 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Float | public JBBPDslBuilder Float(final String name) {
final Item item = new Item(BinType.FLOAT, name, this.byteOrder);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder Float(final String name) {
final Item item = new Item(BinType.FLOAT, name, this.byteOrder);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"Float",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"FLOAT",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named float field
@param name name of the field, can be null for anonymous
@return the builder instance, must not be null | [
"Add",
"named",
"float",
"field"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1223-L1227 |
141,988 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.FloatArray | public JBBPDslBuilder FloatArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.FLOAT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder FloatArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.FLOAT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"FloatArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"FLOAT_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named float array which size calculated through expression.
@param name name of the field, can be null for anonymous
@param sizeExpression expression to be used to calculate size, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"float",
"array",
"which",
"size",
"calculated",
"through",
"expression",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1267-L1272 |
141,989 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Double | public JBBPDslBuilder Double(final String name) {
final Item item = new Item(BinType.DOUBLE, name, this.byteOrder);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder Double(final String name) {
final Item item = new Item(BinType.DOUBLE, name, this.byteOrder);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"Double",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"DOUBLE",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named double field.
@param name name of the field, can be null for anonymous
@return the builder instance, must not be null | [
"Add",
"named",
"double",
"field",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1289-L1293 |
141,990 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Comment | public JBBPDslBuilder Comment(final String text) {
this.addItem(new ItemComment(text == null ? "" : text, false));
return this;
} | java | public JBBPDslBuilder Comment(final String text) {
this.addItem(new ItemComment(text == null ? "" : text, false));
return this;
} | [
"public",
"JBBPDslBuilder",
"Comment",
"(",
"final",
"String",
"text",
")",
"{",
"this",
".",
"addItem",
"(",
"new",
"ItemComment",
"(",
"text",
"==",
"null",
"?",
"\"\"",
":",
"text",
",",
"false",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add comment, in case that a field followed by the comment, the comment will be placed on the same line as field definition.
@param text text of comment, can be null
@return the builder instance, must not be null | [
"Add",
"comment",
"in",
"case",
"that",
"a",
"field",
"followed",
"by",
"the",
"comment",
"the",
"comment",
"will",
"be",
"placed",
"on",
"the",
"same",
"line",
"as",
"field",
"definition",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1301-L1304 |
141,991 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.NewLineComment | public JBBPDslBuilder NewLineComment(final String text) {
this.addItem(new ItemComment(text == null ? "" : text, true));
return this;
} | java | public JBBPDslBuilder NewLineComment(final String text) {
this.addItem(new ItemComment(text == null ? "" : text, true));
return this;
} | [
"public",
"JBBPDslBuilder",
"NewLineComment",
"(",
"final",
"String",
"text",
")",
"{",
"this",
".",
"addItem",
"(",
"new",
"ItemComment",
"(",
"text",
"==",
"null",
"?",
"\"\"",
":",
"text",
",",
"true",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add comment which will be placed on new line.
@param text text of comment, can be null
@return the builder instance, must not be null
@since 1.4.1 | [
"Add",
"comment",
"which",
"will",
"be",
"placed",
"on",
"new",
"line",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1313-L1316 |
141,992 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.DoubleArray | public JBBPDslBuilder DoubleArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.DOUBLE_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder DoubleArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.DOUBLE_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"DoubleArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"DOUBLE_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named double array field which size calculated trough expression.
@param name name of the field, can be null for anonymous
@param sizeExpression expression to be used to calculate array size, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"double",
"array",
"field",
"which",
"size",
"calculated",
"trough",
"expression",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1356-L1361 |
141,993 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.String | public JBBPDslBuilder String(final String name) {
final Item item = new Item(BinType.STRING, name, this.byteOrder);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder String(final String name) {
final Item item = new Item(BinType.STRING, name, this.byteOrder);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"String",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"STRING",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named string field.
@return the builder instance, must not be null | [
"Add",
"named",
"string",
"field",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1377-L1381 |
141,994 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.StringArray | public JBBPDslBuilder StringArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.STRING_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder StringArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.STRING_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"StringArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"STRING_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named string array which size calculated through expression.
@param name name of field, can be null for anonymous
@param sizeExpression expression to calculate size, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"string",
"array",
"which",
"size",
"calculated",
"through",
"expression",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1421-L1426 |
141,995 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.ByteOrder | public JBBPDslBuilder ByteOrder(final JBBPByteOrder order) {
this.byteOrder = order == null ? JBBPByteOrder.BIG_ENDIAN : order;
return this;
} | java | public JBBPDslBuilder ByteOrder(final JBBPByteOrder order) {
this.byteOrder = order == null ? JBBPByteOrder.BIG_ENDIAN : order;
return this;
} | [
"public",
"JBBPDslBuilder",
"ByteOrder",
"(",
"final",
"JBBPByteOrder",
"order",
")",
"{",
"this",
".",
"byteOrder",
"=",
"order",
"==",
"null",
"?",
"JBBPByteOrder",
".",
"BIG_ENDIAN",
":",
"order",
";",
"return",
"this",
";",
"}"
] | Set byte order for next fields
@param order order, if null then BIG_ENDIAN
@return the builder instance, must not be null | [
"Set",
"byte",
"order",
"for",
"next",
"fields"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1434-L1437 |
141,996 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.collectAnnotatedFields | protected BinFieldContainer collectAnnotatedFields(final Class<?> annotatedClass) {
final Bin defautBin = annotatedClass.getAnnotation(Bin.class);
final DslBinCustom defaultBinCustom = annotatedClass.getAnnotation(DslBinCustom.class);
final BinFieldContainer result;
if (defautBin != null) {
result = new BinFieldContainer(annotatedClass, defautBin, true, null);
} else if (defaultBinCustom != null) {
result = new BinFieldContainer(annotatedClass, defaultBinCustom, true, null);
} else {
result = new BinFieldContainer(annotatedClass, null);
}
final Class<?> superclazz = annotatedClass.getSuperclass();
if (superclazz != null && superclazz != Object.class) {
final BinFieldContainer parentFields = collectAnnotatedFields(superclazz);
if (!parentFields.fields.isEmpty()) {
result.addAllFromContainer(parentFields);
}
}
for (final Field f : annotatedClass.getDeclaredFields()) {
if ((f.getModifiers() & (Modifier.NATIVE | Modifier.STATIC | Modifier.FINAL | Modifier.PRIVATE | Modifier.TRANSIENT)) == 0) {
final Bin fieldBinAnno = f.getAnnotation(Bin.class);
final DslBinCustom fieldBinCustomAnno = f.getAnnotation(DslBinCustom.class);
if (fieldBinAnno != null || defautBin != null || defaultBinCustom != null || fieldBinCustomAnno != null) {
validateAnnotatedField(defautBin, fieldBinAnno, defaultBinCustom, fieldBinCustomAnno, f);
final Class<?> type = f.getType().isArray() ? f.getType().getComponentType() : f.getType();
if (type.isPrimitive() || type == String.class) {
if (fieldBinAnno != null || fieldBinCustomAnno != null) {
if (fieldBinAnno != null) {
result.addBinField(fieldBinAnno, true, f);
} else {
result.addBinCustomField(fieldBinCustomAnno, true, f);
}
} else {
if (defautBin != null) {
result.addBinField(defautBin, false, f);
} else {
result.addBinCustomField(defaultBinCustom, false, f);
}
}
} else {
final BinFieldContainer container = collectAnnotatedFields(type);
if (!container.fields.isEmpty()) {
if (fieldBinAnno != null) {
container.bin = fieldBinAnno;
container.fieldLocalAnnotation = true;
} else if (fieldBinCustomAnno != null) {
container.binCustom = fieldBinCustomAnno;
container.fieldLocalAnnotation = true;
}
container.field = f;
result.addContainer(container);
}
}
}
}
}
result.sort();
if (!result.fields.isEmpty()) {
result.addContainer(BinFieldContainer.END_STRUCT);
}
return result;
} | java | protected BinFieldContainer collectAnnotatedFields(final Class<?> annotatedClass) {
final Bin defautBin = annotatedClass.getAnnotation(Bin.class);
final DslBinCustom defaultBinCustom = annotatedClass.getAnnotation(DslBinCustom.class);
final BinFieldContainer result;
if (defautBin != null) {
result = new BinFieldContainer(annotatedClass, defautBin, true, null);
} else if (defaultBinCustom != null) {
result = new BinFieldContainer(annotatedClass, defaultBinCustom, true, null);
} else {
result = new BinFieldContainer(annotatedClass, null);
}
final Class<?> superclazz = annotatedClass.getSuperclass();
if (superclazz != null && superclazz != Object.class) {
final BinFieldContainer parentFields = collectAnnotatedFields(superclazz);
if (!parentFields.fields.isEmpty()) {
result.addAllFromContainer(parentFields);
}
}
for (final Field f : annotatedClass.getDeclaredFields()) {
if ((f.getModifiers() & (Modifier.NATIVE | Modifier.STATIC | Modifier.FINAL | Modifier.PRIVATE | Modifier.TRANSIENT)) == 0) {
final Bin fieldBinAnno = f.getAnnotation(Bin.class);
final DslBinCustom fieldBinCustomAnno = f.getAnnotation(DslBinCustom.class);
if (fieldBinAnno != null || defautBin != null || defaultBinCustom != null || fieldBinCustomAnno != null) {
validateAnnotatedField(defautBin, fieldBinAnno, defaultBinCustom, fieldBinCustomAnno, f);
final Class<?> type = f.getType().isArray() ? f.getType().getComponentType() : f.getType();
if (type.isPrimitive() || type == String.class) {
if (fieldBinAnno != null || fieldBinCustomAnno != null) {
if (fieldBinAnno != null) {
result.addBinField(fieldBinAnno, true, f);
} else {
result.addBinCustomField(fieldBinCustomAnno, true, f);
}
} else {
if (defautBin != null) {
result.addBinField(defautBin, false, f);
} else {
result.addBinCustomField(defaultBinCustom, false, f);
}
}
} else {
final BinFieldContainer container = collectAnnotatedFields(type);
if (!container.fields.isEmpty()) {
if (fieldBinAnno != null) {
container.bin = fieldBinAnno;
container.fieldLocalAnnotation = true;
} else if (fieldBinCustomAnno != null) {
container.binCustom = fieldBinCustomAnno;
container.fieldLocalAnnotation = true;
}
container.field = f;
result.addContainer(container);
}
}
}
}
}
result.sort();
if (!result.fields.isEmpty()) {
result.addContainer(BinFieldContainer.END_STRUCT);
}
return result;
} | [
"protected",
"BinFieldContainer",
"collectAnnotatedFields",
"(",
"final",
"Class",
"<",
"?",
">",
"annotatedClass",
")",
"{",
"final",
"Bin",
"defautBin",
"=",
"annotatedClass",
".",
"getAnnotation",
"(",
"Bin",
".",
"class",
")",
";",
"final",
"DslBinCustom",
"defaultBinCustom",
"=",
"annotatedClass",
".",
"getAnnotation",
"(",
"DslBinCustom",
".",
"class",
")",
";",
"final",
"BinFieldContainer",
"result",
";",
"if",
"(",
"defautBin",
"!=",
"null",
")",
"{",
"result",
"=",
"new",
"BinFieldContainer",
"(",
"annotatedClass",
",",
"defautBin",
",",
"true",
",",
"null",
")",
";",
"}",
"else",
"if",
"(",
"defaultBinCustom",
"!=",
"null",
")",
"{",
"result",
"=",
"new",
"BinFieldContainer",
"(",
"annotatedClass",
",",
"defaultBinCustom",
",",
"true",
",",
"null",
")",
";",
"}",
"else",
"{",
"result",
"=",
"new",
"BinFieldContainer",
"(",
"annotatedClass",
",",
"null",
")",
";",
"}",
"final",
"Class",
"<",
"?",
">",
"superclazz",
"=",
"annotatedClass",
".",
"getSuperclass",
"(",
")",
";",
"if",
"(",
"superclazz",
"!=",
"null",
"&&",
"superclazz",
"!=",
"Object",
".",
"class",
")",
"{",
"final",
"BinFieldContainer",
"parentFields",
"=",
"collectAnnotatedFields",
"(",
"superclazz",
")",
";",
"if",
"(",
"!",
"parentFields",
".",
"fields",
".",
"isEmpty",
"(",
")",
")",
"{",
"result",
".",
"addAllFromContainer",
"(",
"parentFields",
")",
";",
"}",
"}",
"for",
"(",
"final",
"Field",
"f",
":",
"annotatedClass",
".",
"getDeclaredFields",
"(",
")",
")",
"{",
"if",
"(",
"(",
"f",
".",
"getModifiers",
"(",
")",
"&",
"(",
"Modifier",
".",
"NATIVE",
"|",
"Modifier",
".",
"STATIC",
"|",
"Modifier",
".",
"FINAL",
"|",
"Modifier",
".",
"PRIVATE",
"|",
"Modifier",
".",
"TRANSIENT",
")",
")",
"==",
"0",
")",
"{",
"final",
"Bin",
"fieldBinAnno",
"=",
"f",
".",
"getAnnotation",
"(",
"Bin",
".",
"class",
")",
";",
"final",
"DslBinCustom",
"fieldBinCustomAnno",
"=",
"f",
".",
"getAnnotation",
"(",
"DslBinCustom",
".",
"class",
")",
";",
"if",
"(",
"fieldBinAnno",
"!=",
"null",
"||",
"defautBin",
"!=",
"null",
"||",
"defaultBinCustom",
"!=",
"null",
"||",
"fieldBinCustomAnno",
"!=",
"null",
")",
"{",
"validateAnnotatedField",
"(",
"defautBin",
",",
"fieldBinAnno",
",",
"defaultBinCustom",
",",
"fieldBinCustomAnno",
",",
"f",
")",
";",
"final",
"Class",
"<",
"?",
">",
"type",
"=",
"f",
".",
"getType",
"(",
")",
".",
"isArray",
"(",
")",
"?",
"f",
".",
"getType",
"(",
")",
".",
"getComponentType",
"(",
")",
":",
"f",
".",
"getType",
"(",
")",
";",
"if",
"(",
"type",
".",
"isPrimitive",
"(",
")",
"||",
"type",
"==",
"String",
".",
"class",
")",
"{",
"if",
"(",
"fieldBinAnno",
"!=",
"null",
"||",
"fieldBinCustomAnno",
"!=",
"null",
")",
"{",
"if",
"(",
"fieldBinAnno",
"!=",
"null",
")",
"{",
"result",
".",
"addBinField",
"(",
"fieldBinAnno",
",",
"true",
",",
"f",
")",
";",
"}",
"else",
"{",
"result",
".",
"addBinCustomField",
"(",
"fieldBinCustomAnno",
",",
"true",
",",
"f",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"defautBin",
"!=",
"null",
")",
"{",
"result",
".",
"addBinField",
"(",
"defautBin",
",",
"false",
",",
"f",
")",
";",
"}",
"else",
"{",
"result",
".",
"addBinCustomField",
"(",
"defaultBinCustom",
",",
"false",
",",
"f",
")",
";",
"}",
"}",
"}",
"else",
"{",
"final",
"BinFieldContainer",
"container",
"=",
"collectAnnotatedFields",
"(",
"type",
")",
";",
"if",
"(",
"!",
"container",
".",
"fields",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"fieldBinAnno",
"!=",
"null",
")",
"{",
"container",
".",
"bin",
"=",
"fieldBinAnno",
";",
"container",
".",
"fieldLocalAnnotation",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"fieldBinCustomAnno",
"!=",
"null",
")",
"{",
"container",
".",
"binCustom",
"=",
"fieldBinCustomAnno",
";",
"container",
".",
"fieldLocalAnnotation",
"=",
"true",
";",
"}",
"container",
".",
"field",
"=",
"f",
";",
"result",
".",
"addContainer",
"(",
"container",
")",
";",
"}",
"}",
"}",
"}",
"}",
"result",
".",
"sort",
"(",
")",
";",
"if",
"(",
"!",
"result",
".",
"fields",
".",
"isEmpty",
"(",
")",
")",
"{",
"result",
".",
"addContainer",
"(",
"BinFieldContainer",
".",
"END_STRUCT",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Allows to collect all fields which can be used for scripting.
@param annotatedClass class to be processed, must not be null
@return container which contains all found items | [
"Allows",
"to",
"collect",
"all",
"fields",
"which",
"can",
"be",
"used",
"for",
"scripting",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1552-L1622 |
141,997 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.readBoolArray | public boolean[] readBoolArray(final int items) throws IOException {
int pos = 0;
byte[] buffer;
if (items < 0) {
buffer = new byte[INITIAL_ARRAY_BUFFER_SIZE];
// till end
while (true) {
final int read = this.read(buffer, pos, buffer.length - pos);
if (read < 0) {
break;
}
pos += read;
if (buffer.length == pos) {
final byte[] newbuffer = new byte[buffer.length << 1];
System.arraycopy(buffer, 0, newbuffer, 0, buffer.length);
buffer = newbuffer;
}
}
} else {
// number
buffer = new byte[items];
int len = items;
while (len > 0) {
final int read = this.read(buffer, pos, len);
if (read < 0) {
throw new EOFException("Have read only " + pos + " bit portions instead of " + items);
}
pos += read;
len -= read;
}
}
final boolean[] result = new boolean[pos];
for (int i = 0; i < pos; i++) {
result[i] = buffer[i] != 0;
}
return result;
} | java | public boolean[] readBoolArray(final int items) throws IOException {
int pos = 0;
byte[] buffer;
if (items < 0) {
buffer = new byte[INITIAL_ARRAY_BUFFER_SIZE];
// till end
while (true) {
final int read = this.read(buffer, pos, buffer.length - pos);
if (read < 0) {
break;
}
pos += read;
if (buffer.length == pos) {
final byte[] newbuffer = new byte[buffer.length << 1];
System.arraycopy(buffer, 0, newbuffer, 0, buffer.length);
buffer = newbuffer;
}
}
} else {
// number
buffer = new byte[items];
int len = items;
while (len > 0) {
final int read = this.read(buffer, pos, len);
if (read < 0) {
throw new EOFException("Have read only " + pos + " bit portions instead of " + items);
}
pos += read;
len -= read;
}
}
final boolean[] result = new boolean[pos];
for (int i = 0; i < pos; i++) {
result[i] = buffer[i] != 0;
}
return result;
} | [
"public",
"boolean",
"[",
"]",
"readBoolArray",
"(",
"final",
"int",
"items",
")",
"throws",
"IOException",
"{",
"int",
"pos",
"=",
"0",
";",
"byte",
"[",
"]",
"buffer",
";",
"if",
"(",
"items",
"<",
"0",
")",
"{",
"buffer",
"=",
"new",
"byte",
"[",
"INITIAL_ARRAY_BUFFER_SIZE",
"]",
";",
"// till end",
"while",
"(",
"true",
")",
"{",
"final",
"int",
"read",
"=",
"this",
".",
"read",
"(",
"buffer",
",",
"pos",
",",
"buffer",
".",
"length",
"-",
"pos",
")",
";",
"if",
"(",
"read",
"<",
"0",
")",
"{",
"break",
";",
"}",
"pos",
"+=",
"read",
";",
"if",
"(",
"buffer",
".",
"length",
"==",
"pos",
")",
"{",
"final",
"byte",
"[",
"]",
"newbuffer",
"=",
"new",
"byte",
"[",
"buffer",
".",
"length",
"<<",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"buffer",
",",
"0",
",",
"newbuffer",
",",
"0",
",",
"buffer",
".",
"length",
")",
";",
"buffer",
"=",
"newbuffer",
";",
"}",
"}",
"}",
"else",
"{",
"// number",
"buffer",
"=",
"new",
"byte",
"[",
"items",
"]",
";",
"int",
"len",
"=",
"items",
";",
"while",
"(",
"len",
">",
"0",
")",
"{",
"final",
"int",
"read",
"=",
"this",
".",
"read",
"(",
"buffer",
",",
"pos",
",",
"len",
")",
";",
"if",
"(",
"read",
"<",
"0",
")",
"{",
"throw",
"new",
"EOFException",
"(",
"\"Have read only \"",
"+",
"pos",
"+",
"\" bit portions instead of \"",
"+",
"items",
")",
";",
"}",
"pos",
"+=",
"read",
";",
"len",
"-=",
"read",
";",
"}",
"}",
"final",
"boolean",
"[",
"]",
"result",
"=",
"new",
"boolean",
"[",
"pos",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pos",
";",
"i",
"++",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"buffer",
"[",
"i",
"]",
"!=",
"0",
";",
"}",
"return",
"result",
";",
"}"
] | Read array of boolean values.
@param items number of items to be read, if less than zero then read whole
stream till the end
@return read values as boolean array
@throws IOException it will be thrown for transport error | [
"Read",
"array",
"of",
"boolean",
"values",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L101-L139 |
141,998 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.readByteArray | public byte[] readByteArray(final int items, final JBBPByteOrder byteOrder) throws IOException {
final byte[] result = _readArray(items, null);
if (byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
JBBPUtils.reverseArray(result);
}
return result;
} | java | public byte[] readByteArray(final int items, final JBBPByteOrder byteOrder) throws IOException {
final byte[] result = _readArray(items, null);
if (byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
JBBPUtils.reverseArray(result);
}
return result;
} | [
"public",
"byte",
"[",
"]",
"readByteArray",
"(",
"final",
"int",
"items",
",",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"result",
"=",
"_readArray",
"(",
"items",
",",
"null",
")",
";",
"if",
"(",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"LITTLE_ENDIAN",
")",
"{",
"JBBPUtils",
".",
"reverseArray",
"(",
"result",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Read number of bytes for the stream. Invert their order if byte order is LITTLE_ENDIAN
@param items number of items to be read, if less than zero then read whole
stream till the end
@param byteOrder desired order of bytes
@return read byte items as a byte array, if byte order is LITTLE_ENDIAN then the result array will be reversed one
@throws IOException it will be thrown for any transport problem during the
operation
@see JBBPByteOrder#LITTLE_ENDIAN
@since 1.3.0 | [
"Read",
"number",
"of",
"bytes",
"for",
"the",
"stream",
".",
"Invert",
"their",
"order",
"if",
"byte",
"order",
"is",
"LITTLE_ENDIAN"
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L226-L232 |
141,999 | raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.readShortArray | public short[] readShortArray(final int items, final JBBPByteOrder byteOrder) throws IOException {
int pos = 0;
if (items < 0) {
short[] buffer = new short[INITIAL_ARRAY_BUFFER_SIZE];
// till end
while (hasAvailableData()) {
final int next = readUnsignedShort(byteOrder);
if (buffer.length == pos) {
final short[] newbuffer = new short[buffer.length << 1];
System.arraycopy(buffer, 0, newbuffer, 0, buffer.length);
buffer = newbuffer;
}
buffer[pos++] = (short) next;
}
if (buffer.length == pos) {
return buffer;
}
final short[] result = new short[pos];
System.arraycopy(buffer, 0, result, 0, pos);
return result;
} else {
// number
final short[] buffer = new short[items];
for (int i = 0; i < items; i++) {
buffer[i] = (short) readUnsignedShort(byteOrder);
}
return buffer;
}
} | java | public short[] readShortArray(final int items, final JBBPByteOrder byteOrder) throws IOException {
int pos = 0;
if (items < 0) {
short[] buffer = new short[INITIAL_ARRAY_BUFFER_SIZE];
// till end
while (hasAvailableData()) {
final int next = readUnsignedShort(byteOrder);
if (buffer.length == pos) {
final short[] newbuffer = new short[buffer.length << 1];
System.arraycopy(buffer, 0, newbuffer, 0, buffer.length);
buffer = newbuffer;
}
buffer[pos++] = (short) next;
}
if (buffer.length == pos) {
return buffer;
}
final short[] result = new short[pos];
System.arraycopy(buffer, 0, result, 0, pos);
return result;
} else {
// number
final short[] buffer = new short[items];
for (int i = 0; i < items; i++) {
buffer[i] = (short) readUnsignedShort(byteOrder);
}
return buffer;
}
} | [
"public",
"short",
"[",
"]",
"readShortArray",
"(",
"final",
"int",
"items",
",",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"int",
"pos",
"=",
"0",
";",
"if",
"(",
"items",
"<",
"0",
")",
"{",
"short",
"[",
"]",
"buffer",
"=",
"new",
"short",
"[",
"INITIAL_ARRAY_BUFFER_SIZE",
"]",
";",
"// till end",
"while",
"(",
"hasAvailableData",
"(",
")",
")",
"{",
"final",
"int",
"next",
"=",
"readUnsignedShort",
"(",
"byteOrder",
")",
";",
"if",
"(",
"buffer",
".",
"length",
"==",
"pos",
")",
"{",
"final",
"short",
"[",
"]",
"newbuffer",
"=",
"new",
"short",
"[",
"buffer",
".",
"length",
"<<",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"buffer",
",",
"0",
",",
"newbuffer",
",",
"0",
",",
"buffer",
".",
"length",
")",
";",
"buffer",
"=",
"newbuffer",
";",
"}",
"buffer",
"[",
"pos",
"++",
"]",
"=",
"(",
"short",
")",
"next",
";",
"}",
"if",
"(",
"buffer",
".",
"length",
"==",
"pos",
")",
"{",
"return",
"buffer",
";",
"}",
"final",
"short",
"[",
"]",
"result",
"=",
"new",
"short",
"[",
"pos",
"]",
";",
"System",
".",
"arraycopy",
"(",
"buffer",
",",
"0",
",",
"result",
",",
"0",
",",
"pos",
")",
";",
"return",
"result",
";",
"}",
"else",
"{",
"// number",
"final",
"short",
"[",
"]",
"buffer",
"=",
"new",
"short",
"[",
"items",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"items",
";",
"i",
"++",
")",
"{",
"buffer",
"[",
"i",
"]",
"=",
"(",
"short",
")",
"readUnsignedShort",
"(",
"byteOrder",
")",
";",
"}",
"return",
"buffer",
";",
"}",
"}"
] | Read number of short items from the input stream.
@param items number of items to be read from the input stream, if less than
zero then all stream till the end will be read
@param byteOrder the order of bytes to be used to decode short values
@return read items as a short array
@throws IOException it will be thrown for any transport problem during the
operation
@see JBBPByteOrder#BIG_ENDIAN
@see JBBPByteOrder#LITTLE_ENDIAN | [
"Read",
"number",
"of",
"short",
"items",
"from",
"the",
"input",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L246-L274 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.