idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
21,500
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 ) { print...
Print byte value .
21,501
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 .
21,502
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 .
21,503
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 .
21,504
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
21,505
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 = ...
Set number of spaces per tab .
21,506
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 . maxCharsRa...
Set radix .
21,507
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 ) { f...
Print short value .
21,508
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 fl...
Print float value .
21,509
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...
Print double value .
21,510
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 .
21,511
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
21,512
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
21,513
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
21,514
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 val...
Print integer value
21,515
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 .
21,516
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 ...
Print long value
21,517
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 .
21,518
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 .
21,519
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 .
21,520
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 ...
Print comments . Wilt aligning of line start for multi - line comment . Comments will be printed only if they are allowed .
21,521
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 . doConvertObjToS...
Print objects .
21,522
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 .
21,523
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 )...
Main method writing a char into wrapped writer .
21,524
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 .
21,525
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 .
21,526
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 th...
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 .
21,527
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 .
21,528
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 .
21,529
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 .
21,530
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
21,531
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 .
21,532
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 .
21,533
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 .
21,534
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 .
21,535
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 .
21,536
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
21,537
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 .
21,538
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 .
21,539
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 .
21,540
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 .
21,541
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 ) ...
Output data externally .
21,542
public JBBPIntegerValueEvaluator make ( final String expression , final List < JBBPNamedFieldInfo > namedFields , final byte [ ] compiledScript ) { final JBBPIntegerValueEvaluator result ; if ( JBBPExpressionEvaluator . hasExpressionOperators ( expression ) ) { result = new JBBPExpressionEvaluator ( expression , namedF...
Make an appropriate evaluator for an expression text .
21,543
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 .
21,544
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...
Register a name field info item in a named field list .
21,545
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 .
21,546
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 ( ...
The Method prepares a byte - code for a token field type and modifiers .
21,547
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 ( ...
Convert an array field into its string representation .
21,548
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...
Set a value to a field of a class instance . Can t be used for static fields!
21,549
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 ) ;...
Get a value of a field from a class instance .
21,550
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 [ ...
Map a parsed array to an array field in mapping class .
21,551
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
21,552
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
21,553
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 .
21,554
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 Cl...
Make stub arguments for a constructor .
21,555
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...
Find a constructor for an inner class .
21,556
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 ...
Find a constructor for a static class .
21,557
public JBBPDslBuilder Custom ( final String type , final String name ) { return this . Custom ( type , name , null ) ; }
Add named custom variable .
21,558
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 .
21,559
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 .
21,560
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 .
21,561
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
21,562
public JBBPDslBuilder CustomArray ( final String type , final String size ) { return this . CustomArray ( type , null , size , null ) ; }
Create anonymous custom type array with fixed size .
21,563
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 - ...
Add directive to close currently opened structure or all opened structures .
21,564
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 .
21,565
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 .
21,566
public JBBPDslBuilder BitArray ( final JBBPBitNumber bits , final int size ) { return this . BitArray ( null , bits , arraySizeToString ( size ) ) ; }
Add anonymous fixed length bit array .
21,567
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 .
21,568
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 .
21,569
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 thi...
Add named bit array with size calculated through expression .
21,570
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 ( sizeE...
Add named bit array where each bit length is calculated through expression .
21,571
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 .
21,572
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 .
21,573
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 .
21,574
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 .
21,575
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 .
21,576
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 .
21,577
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 .
21,578
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 .
21,579
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 .
21,580
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 .
21,581
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 .
21,582
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 .
21,583
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 .
21,584
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 .
21,585
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
21,586
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 .
21,587
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 .
21,588
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 .
21,589
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 .
21,590
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 .
21,591
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 .
21,592
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 .
21,593
public JBBPDslBuilder ByteOrder ( final JBBPByteOrder order ) { this . byteOrder = order == null ? JBBPByteOrder . BIG_ENDIAN : order ; return this ; }
Set byte order for next fields
21,594
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 ) { res...
Allows to collect all fields which can be used for scripting .
21,595
public boolean [ ] readBoolArray ( final int items ) throws IOException { int pos = 0 ; byte [ ] buffer ; if ( items < 0 ) { buffer = new byte [ INITIAL_ARRAY_BUFFER_SIZE ] ; while ( true ) { final int read = this . read ( buffer , pos , buffer . length - pos ) ; if ( read < 0 ) { break ; } pos += read ; if ( buffer . ...
Read array of boolean values .
21,596
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
21,597
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 ] ; while ( hasAvailableData ( ) ) { final int next = readUnsignedShort ( byteOrder ) ; if ( buffer . length == pos ) { final...
Read number of short items from the input stream .
21,598
public int [ ] readIntArray ( final int items , final JBBPByteOrder byteOrder ) throws IOException { int pos = 0 ; if ( items < 0 ) { int [ ] buffer = new int [ INITIAL_ARRAY_BUFFER_SIZE ] ; while ( hasAvailableData ( ) ) { final int next = readInt ( byteOrder ) ; if ( buffer . length == pos ) { final int [ ] newbuffer...
Read number of integer items from the input stream .
21,599
public float [ ] readFloatArray ( final int items , final JBBPByteOrder byteOrder ) throws IOException { int pos = 0 ; if ( items < 0 ) { float [ ] buffer = new float [ INITIAL_ARRAY_BUFFER_SIZE ] ; while ( hasAvailableData ( ) ) { final float next = readFloat ( byteOrder ) ; if ( buffer . length == pos ) { final float...
Read number of float items from the input stream .