protected static DBFField createField ( DataInput in , Charset charset , boolean useFieldFlags ) throws IOException { DBFField field = new DBFField ( ) ; byte t_byte = in . readByte ( ) ; /* 0 */ if ( t_byte == ( byte ) 0x0d ) { return null ; } byte [ ] fieldName = new byte [ 11 ] ; in . readFully ( fieldName , 1 , 10 ) ; /* 1-10 */ fieldName [ 0 ] = t_byte ; int nameNullIndex = fieldName . length - 1 ; for ( int i = 0 ; i < fieldName . length ; i ++ ) { if ( fieldName [ i ] == ( byte ) 0 ) { nameNullIndex = i ; break ; } } field . name = new String ( fieldName , 0 , nameNullIndex , charset ) ; try { field . type = DBFDataType . fromCode ( in . readByte ( ) ) ; /* 11 */ } catch ( Exception e ) { field . type = DBFDataType . UNKNOWN ; } field . reserv1 = DBFUtils . readLittleEndianInt ( in ) ; /* 12-15 */ field . length = in . readUnsignedByte ( ) ; /* 16 */ field . decimalCount = in . readByte ( ) ; /* 17 */ field . reserv2 = DBFUtils . readLittleEndianShort ( in ) ; /* 18-19 */ field . workAreaId = in . readByte ( ) ; /* 20 */ field . reserv3 = DBFUtils . readLittleEndianShort ( in ) ; /* 21-22 */ field . setFieldsFlag = in . readByte ( ) ; /* 23 */ in . readFully ( field . reserv4 ) ; /* 24-30 */ field . indexFieldFlag = in . readByte ( ) ; /* 31 */ adjustLengthForLongCharSupport ( field ) ; if ( ! useFieldFlags ) { field . reserv2 = 0 ; } return field ; }
Creates a DBFField object from the data read from the given DataInputStream .