List of usage examples for java.lang Double longBitsToDouble
@HotSpotIntrinsicCandidate public static native double longBitsToDouble(long bits);
From source file:org.efaps.webdav4vfs.test.ramvfs.RamFileRandomAccessContent.java
/** * {@inheritDoc}//from ww w . jav a 2s. com */ public double readDouble() throws IOException { return Double.longBitsToDouble(this.readLong()); }
From source file:org.apache.flex.swf.io.InputBitStream.java
@Override public double readDOUBLE() { return Double.longBitsToDouble(readSI64()); }
From source file:com.pgmacdesign.rsrtoolbox.TEST.java
double getDouble(final SharedPreferences prefs, final String key, final double defaultValue) { return Double.longBitsToDouble(prefs.getLong(key, Double.doubleToLongBits(defaultValue))); }
From source file:com.zju.ccnt.or.binlog.impl.parser.AbstractRowEventParser.java
/** * //w w w . j a v a 2s .c om */ protected Row parseRow(XInputStream is, TableMapEvent tme, BitColumn usedColumns) throws IOException { // int unusedColumnCount = 0; final byte[] types = tme.getColumnTypes(); final Metadata metadata = tme.getColumnMetadata(); final BitColumn nullColumns = is.readBit(types.length, true); final List<Column> columns = new ArrayList<Column>(types.length); for (int i = 0; i < types.length; ++i) { // int length = 0; final int meta = metadata.getMetadata(i); int type = CodecUtils.toUnsigned(types[i]); if (type == MySQLConstants.TYPE_STRING && meta > 256) { final int meta0 = meta >> 8; final int meta1 = meta & 0xFF; if ((meta0 & 0x30) != 0x30) { // a long CHAR() field: see #37426 type = meta0 | 0x30; length = meta1 | (((meta0 & 0x30) ^ 0x30) << 4); } else { switch (meta0) { case MySQLConstants.TYPE_SET: case MySQLConstants.TYPE_ENUM: case MySQLConstants.TYPE_STRING: type = meta0; length = meta1; break; default: throw new NestableRuntimeException("assertion failed, unknown column type: " + type); } } } // if (!usedColumns.get(i)) { unusedColumnCount++; continue; } else if (nullColumns.get(i - unusedColumnCount)) { columns.add(NullColumn.valueOf(type)); continue; } // switch (type) { case MySQLConstants.TYPE_TINY: columns.add(TinyColumn.valueOf(is.readInt(1))); break; case MySQLConstants.TYPE_SHORT: columns.add(ShortColumn.valueOf(CodecUtils.toSigned(is.readInt(2), 2))); break; case MySQLConstants.TYPE_INT24: columns.add(Int24Column.valueOf(CodecUtils.toSigned(is.readInt(3), 3))); break; case MySQLConstants.TYPE_LONG: columns.add(LongColumn.valueOf(is.readInt(4))); break; case MySQLConstants.TYPE_LONGLONG: columns.add(LongLongColumn.valueOf(is.readLong(8))); break; case MySQLConstants.TYPE_FLOAT: columns.add(FloatColumn.valueOf(Float.intBitsToFloat(is.readInt(4)))); break; case MySQLConstants.TYPE_DOUBLE: columns.add(DoubleColumn.valueOf(Double.longBitsToDouble(is.readLong(8)))); break; case MySQLConstants.TYPE_YEAR: columns.add(YearColumn.valueOf(is.readInt(1))); break; case MySQLConstants.TYPE_DATE: columns.add(DateColumn.valueOf(MySQLUtils.toDate(is.readInt(3)))); break; case MySQLConstants.TYPE_TIME: columns.add(TimeColumn.valueOf(MySQLUtils.toTime(is.readInt(3)))); break; case MySQLConstants.TYPE_TIMESTAMP: columns.add(TimestampColumn.valueOf(MySQLUtils.toTimestamp(is.readInt(4)))); break; case MySQLConstants.TYPE_DATETIME: columns.add(DatetimeColumn.valueOf(MySQLUtils.toDatetime(is.readLong(8)))); break; case MySQLConstants.TYPE_ENUM: columns.add(EnumColumn.valueOf(is.readInt(length))); break; case MySQLConstants.TYPE_SET: columns.add(SetColumn.valueOf(is.readLong(length))); break; case MySQLConstants.TYPE_STRING: final int stringLength = length < 256 ? is.readInt(1) : is.readInt(2); columns.add(StringColumn.valueOf(is.readBytes(stringLength))); break; case MySQLConstants.TYPE_BIT: final int bitLength = (meta >> 8) * 8 + (meta & 0xFF); columns.add(BitColumn.valueOf(bitLength, is.readBytes((bitLength + 7) >> 3))); break; case MySQLConstants.TYPE_NEWDECIMAL: final int precision = meta & 0xFF; final int scale = meta >> 8; final int decimalLength = MySQLUtils.getDecimalBinarySize(precision, scale); columns.add(DecimalColumn.valueOf( MySQLUtils.toDecimal(precision, scale, is.readBytes(decimalLength)), precision, scale)); break; case MySQLConstants.TYPE_BLOB: final int blobLength = is.readInt(meta); columns.add(BlobColumn.valueOf(is.readBytes(blobLength))); break; case MySQLConstants.TYPE_VARCHAR: case MySQLConstants.TYPE_VAR_STRING: final int varcharLength = meta < 256 ? is.readInt(1) : is.readInt(2); columns.add(StringColumn.valueOf(is.readBytes(varcharLength))); break; default: throw new NestableRuntimeException("assertion failed, unknown column type: " + type); } } return new Row(columns, tme.getDatabaseName().toString(), tme.getTableName().toString()); }
From source file:be.brunoparmentier.openbikesharing.app.activities.MapActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); getActionBar().setDisplayHomeAsUpEnabled(true); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); stationsDataSource = new StationsDataSource(this); ArrayList<Station> stations = stationsDataSource.getStations(); map = (MapView) findViewById(R.id.mapView); stationMarkerInfoWindow = new StationMarkerInfoWindow(R.layout.bonuspack_bubble, map); /* handling map events */ MapEventsOverlay mapEventsOverlay = new MapEventsOverlay(this, this); map.getOverlays().add(0, mapEventsOverlay); /* markers list */ GridMarkerClusterer stationsMarkers = new GridMarkerClusterer(this); Drawable clusterIconD = getResources().getDrawable(R.drawable.marker_cluster); Bitmap clusterIcon = ((BitmapDrawable) clusterIconD).getBitmap(); map.getOverlays().add(stationsMarkers); stationsMarkers.setIcon(clusterIcon); stationsMarkers.setGridSize(100);//from w w w . j a va 2 s . co m for (final Station station : stations) { stationsMarkers.add(createStationMarker(station)); } map.invalidate(); mapController = map.getController(); mapController.setZoom(16); map.setMultiTouchControls(true); map.setBuiltInZoomControls(true); map.setMinZoomLevel(3); /* map tile source */ String mapLayer = settings.getString("pref_map_layer", ""); switch (mapLayer) { case "mapnik": map.setTileSource(TileSourceFactory.MAPNIK); break; case "cyclemap": map.setTileSource(TileSourceFactory.CYCLEMAP); break; case "osmpublictransport": map.setTileSource(TileSourceFactory.PUBLIC_TRANSPORT); break; case "mapquestosm": map.setTileSource(TileSourceFactory.MAPQUESTOSM); break; default: map.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE); break; } GpsMyLocationProvider imlp = new GpsMyLocationProvider(this.getBaseContext()); imlp.setLocationUpdateMinDistance(1000); imlp.setLocationUpdateMinTime(60000); myLocationOverlay = new MyLocationNewOverlay(this.getBaseContext(), imlp, this.map); map.getOverlays().add(this.myLocationOverlay); myLocationOverlay.enableMyLocation(); try { LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); GeoPoint userLocation = new GeoPoint( locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER)); mapController.animateTo(userLocation); } catch (NullPointerException e) { mapController.setZoom(13); double bikeNetworkLatitude = Double.longBitsToDouble(settings.getLong(PREF_KEY_NETWORK_LATITUDE, 0)); double bikeNetworkLongitude = Double.longBitsToDouble(settings.getLong(PREF_KEY_NETWORK_LONGITUDE, 0)); mapController.animateTo(new GeoPoint(bikeNetworkLatitude, bikeNetworkLongitude)); Toast.makeText(this, R.string.location_not_found, Toast.LENGTH_LONG).show(); } }
From source file:com.tibbo.linkserver.plugin.device.file.item.NumericItem.java
/** * * @param data/*from w w w .j av a2 s . com*/ * @param offset * @return */ @Override public Object bytesToValueRealOffset(byte data[], int offset) { offset *= 2; if (dataType == 2) { return Integer.valueOf((data[offset] & 0xff) << 8 | data[offset + 1] & 0xff); } if (dataType == 3) { return Short.valueOf((short) ((data[offset] & 0xff) << 8 | data[offset + 1] & 0xff)); } if (dataType == 16) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < 2; i++) { sb.append(bcdNibbleToInt(data[offset + i], true)); sb.append(bcdNibbleToInt(data[offset + i], false)); } return Short.valueOf(Short.parseShort(sb.toString())); } if (dataType == 4) { return Long.valueOf((long) (data[offset] & 0xff) << 24 | (long) (data[offset + 1] & 0xff) << 16 | (long) (data[offset + 2] & 0xff) << 8 | (long) (data[offset + 3] & 0xff)); } if (dataType == 5) { return Integer.valueOf((data[offset] & 0xff) << 24 | (data[offset + 1] & 0xff) << 16 | (data[offset + 2] & 0xff) << 8 | data[offset + 3] & 0xff); } if (dataType == 6) { return Long.valueOf((long) (data[offset + 2] & 0xff) << 24 | (long) (data[offset + 3] & 0xff) << 16 | (long) (data[offset] & 0xff) << 8 | (long) (data[offset + 1] & 0xff)); } if (dataType == 7) { return Integer.valueOf((data[offset + 2] & 0xff) << 24 | (data[offset + 3] & 0xff) << 16 | (data[offset] & 0xff) << 8 | data[offset + 1] & 0xff); } if (dataType == 8) { return Float.valueOf(Float.intBitsToFloat((data[offset] & 0xff) << 24 | (data[offset + 1] & 0xff) << 16 | (data[offset + 2] & 0xff) << 8 | data[offset + 3] & 0xff)); } if (dataType == 9) { return Float.valueOf(Float.intBitsToFloat((data[offset + 2] & 0xff) << 24 | (data[offset + 3] & 0xff) << 16 | (data[offset] & 0xff) << 8 | data[offset + 1] & 0xff)); } if (dataType == 17) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < 4; i++) { sb.append(bcdNibbleToInt(data[offset + i], true)); sb.append(bcdNibbleToInt(data[offset + i], false)); } return Integer.valueOf(Integer.parseInt(sb.toString())); } if (dataType == 10) { byte b9[] = new byte[9]; System.arraycopy(data, offset, b9, 1, 8); return new BigInteger(b9); } if (dataType == 11) { return Long.valueOf((long) (data[offset] & 0xff) << 56 | (long) (data[offset + 1] & 0xff) << 48 | (long) (data[offset + 2] & 0xff) << 40 | (long) (data[offset + 3] & 0xff) << 32 | (long) (data[offset + 4] & 0xff) << 24 | (long) (data[offset + 5] & 0xff) << 16 | (long) (data[offset + 6] & 0xff) << 8 | (long) (data[offset + 7] & 0xff)); } if (dataType == 12) { byte b9[] = new byte[9]; b9[1] = data[offset + 6]; b9[2] = data[offset + 7]; b9[3] = data[offset + 4]; b9[4] = data[offset + 5]; b9[5] = data[offset + 2]; b9[6] = data[offset + 3]; b9[7] = data[offset]; b9[8] = data[offset + 1]; return new BigInteger(b9); } if (dataType == 13) { return Long.valueOf((long) (data[offset + 6] & 0xff) << 56 | (long) (data[offset + 7] & 0xff) << 48 | (long) (data[offset + 4] & 0xff) << 40 | (long) (data[offset + 5] & 0xff) << 32 | (long) (data[offset + 2] & 0xff) << 24 | (long) (data[offset + 3] & 0xff) << 16 | (long) (data[offset] & 0xff) << 8 | (long) (data[offset + 1] & 0xff)); } if (dataType == 14) { return Double.valueOf(Double .longBitsToDouble((long) (data[offset] & 0xff) << 56 | (long) (data[offset + 1] & 0xff) << 48 | (long) (data[offset + 2] & 0xff) << 40 | (long) (data[offset + 3] & 0xff) << 32 | (long) (data[offset + 4] & 0xff) << 24 | (long) (data[offset + 5] & 0xff) << 16 | (long) (data[offset + 6] & 0xff) << 8 | (long) (data[offset + 7] & 0xff))); } if (dataType == 15) { return Double.valueOf(Double.longBitsToDouble( (long) (data[offset + 6] & 0xff) << 56 | (long) (data[offset + 7] & 0xff) << 48 | (long) (data[offset + 4] & 0xff) << 40 | (long) (data[offset + 5] & 0xff) << 32 | (long) (data[offset + 2] & 0xff) << 24 | (long) (data[offset + 3] & 0xff) << 16 | (long) (data[offset] & 0xff) << 8 | (long) (data[offset + 1] & 0xff))); } else { throw new RuntimeException( (new StringBuilder()).append("Unsupported data type: ").append(dataType).toString()); } }
From source file:com.google.code.or.binlog.impl.parser.AbstractRowEventParser.java
/** * //w ww. jav a 2s. c o m */ protected Row parseRow(XInputStream is, TableMapEvent tme, BitColumn usedColumns) throws IOException { // int unusedColumnCount = 0; final byte[] types = tme.getColumnTypes(); final Metadata metadata = tme.getColumnMetadata(); final BitColumn nullColumns = is.readBit(types.length, true); final List<Column> columns = new ArrayList<Column>(types.length); for (int i = 0; i < types.length; ++i) { // int length = 0; final int meta = metadata.getMetadata(i); int type = CodecUtils.toUnsigned(types[i]); int fspLen = 0; // fraction second part length for time data types if (type == MySQLConstants.TYPE_STRING && meta > 256) { final int meta0 = meta >> 8; final int meta1 = meta & 0xFF; if ((meta0 & 0x30) != 0x30) { // a long CHAR() field: see #37426 type = meta0 | 0x30; length = meta1 | (((meta0 & 0x30) ^ 0x30) << 4); } else { switch (meta0) { case MySQLConstants.TYPE_SET: case MySQLConstants.TYPE_ENUM: case MySQLConstants.TYPE_STRING: type = meta0; length = meta1; break; default: throw new NestableRuntimeException("assertion failed, unknown column type: " + type); } } } else if (type == MySQLConstants.TYPE_TIMESTAMP2 || type == MySQLConstants.TYPE_TIME2 || type == MySQLConstants.TYPE_DATETIME2) { // http://dev.mysql.com/doc/internals/en/date-and-time-data-type-representation.html fspLen = meta > 0 ? (meta + 1) >> 1 : 0; } if (!usedColumns.get(i)) { unusedColumnCount++; continue; } else if (nullColumns.get(i - unusedColumnCount)) { columns.add(NullColumn.valueOf(type)); continue; } // switch (type) { case MySQLConstants.TYPE_TINY: columns.add(TinyColumn.valueOf(is.readInt(1))); break; case MySQLConstants.TYPE_SHORT: columns.add(ShortColumn.valueOf(is.readInt(2))); break; case MySQLConstants.TYPE_INT24: columns.add(Int24Column.valueOf(is.readInt(3))); break; case MySQLConstants.TYPE_LONG: columns.add(LongColumn.valueOf(is.readInt(4))); break; case MySQLConstants.TYPE_LONGLONG: columns.add(LongLongColumn.valueOf(is.readLong(8))); break; case MySQLConstants.TYPE_FLOAT: columns.add(FloatColumn.valueOf(Float.intBitsToFloat(is.readInt(4)))); break; case MySQLConstants.TYPE_DOUBLE: columns.add(DoubleColumn.valueOf(Double.longBitsToDouble(is.readLong(8)))); break; case MySQLConstants.TYPE_YEAR: columns.add(YearColumn.valueOf(MySQLUtils.toYear(is.readInt(1)))); break; case MySQLConstants.TYPE_DATE: columns.add(DateColumn.valueOf(MySQLUtils.toDate(is.readInt(3)))); break; case MySQLConstants.TYPE_TIME: columns.add(TimeColumn.valueOf(MySQLUtils.toTime(is.readInt(3)))); break; case MySQLConstants.TYPE_TIMESTAMP2: columns.add(TimestampColumn.valueOf(MySQLUtils.toTimestamp( CodecUtils.convertBigEndianToLong(is.readBytes(4), 4), fspLen > 0 ? (int) CodecUtils.convertBigEndianToLong(is.readBytes(fspLen), fspLen) : 0, fspLen))); break; case MySQLConstants.TYPE_TIME2: columns.add(TimeColumn.valueOf(MySQLUtils.toTime( CodecUtils.convertBigEndianToLong(is.readBytes(3), 3), fspLen > 0 ? (int) CodecUtils.convertBigEndianToLong(is.readBytes(fspLen), fspLen) : 0, fspLen))); break; case MySQLConstants.TYPE_DATETIME2: columns.add(DatetimeColumn.valueOf(MySQLUtils.toDatetime( CodecUtils.convertBigEndianToLong(is.readBytes(5), 5), fspLen > 0 ? (int) CodecUtils.convertBigEndianToLong(is.readBytes(fspLen), fspLen) : 0, fspLen))); break; case MySQLConstants.TYPE_TIMESTAMP: columns.add(TimestampColumn.valueOf(MySQLUtils.toTimestamp(is.readLong(4)))); break; case MySQLConstants.TYPE_DATETIME: columns.add(DatetimeColumn.valueOf(MySQLUtils.toDatetime(is.readLong(8)))); break; case MySQLConstants.TYPE_ENUM: columns.add(EnumColumn.valueOf(is.readInt(length))); break; case MySQLConstants.TYPE_SET: columns.add(SetColumn.valueOf(is.readLong(length))); break; case MySQLConstants.TYPE_STRING: final int stringLength = length < 256 ? is.readInt(1) : is.readInt(2); columns.add(is.readFixedLengthString(stringLength)); break; case MySQLConstants.TYPE_BIT: final int bitLength = (meta >> 8) * 8 + (meta & 0xFF); columns.add(is.readBit(bitLength, false)); break; case MySQLConstants.TYPE_NEWDECIMAL: final int precision = meta & 0xFF; final int scale = meta >> 8; final int decimalLength = MySQLUtils.getDecimalBinarySize(precision, scale); columns.add(DecimalColumn.valueOf( MySQLUtils.toDecimal(precision, scale, is.readBytes(decimalLength)), precision, scale)); break; case MySQLConstants.TYPE_BLOB: final int blobLength = is.readInt(meta); columns.add(BlobColumn.valueOf(is.readBytes(blobLength))); break; case MySQLConstants.TYPE_VARCHAR: case MySQLConstants.TYPE_VAR_STRING: final int varcharLength = meta < 256 ? is.readInt(1) : is.readInt(2); columns.add(is.readFixedLengthString(varcharLength)); break; default: throw new NestableRuntimeException("assertion failed, unknown column type: " + type); } } return new Row(columns); }
From source file:etymology.util.EtyMath.java
public static double approxPow(final double a, final double b) { final int x = (int) (Double.doubleToLongBits(a) >> 32); final int y = (int) (b * (x - 1072632447) + 1072632447); return Double.longBitsToDouble(((long) y) << 32); }
From source file:etymology.util.EtyMath.java
public static double approxExp(double val) { final long tmp = (long) (1512775 * val + (1072693248 - 60801)); return Double.longBitsToDouble(tmp << 32); }
From source file:com.dianping.puma.parser.mysql.event.AbstractRowsEvent.java
/** * /*ww w .j av a 2s . c o m*/ * @see http://code.google.com/p/open-replicator/ * @param buf * @param usedColumns * @return * @throws IOException */ protected Row parseRow(ByteBuffer buf, BitSet usedColumns) throws IOException { int unusedColumnCount = 0; byte[] types = tableMapEvent.getColumnTypes(); Metadata metadata = tableMapEvent.getColumnMetadata(); BitSet nullColumns = PacketUtils.readBitSet(buf, types.length); List<Column> columns = new ArrayList<Column>(types.length); for (int i = 0; i < types.length; ++i) { int length = 0; int meta = metadata.getMetadata(i); int type = CodecUtils.toUnsigned(types[i]); if (type == BinlogConstants.MYSQL_TYPE_STRING && meta > 256) { int meta0 = meta >> 8; int meta1 = meta & 0xFF; if ((meta0 & 0x30) != 0x30) { type = meta0 | 0x30; length = meta1 | (((meta0 & 0x30) ^ 0x30) << 4); } else { switch (meta0) { case BinlogConstants.MYSQL_TYPE_SET: case BinlogConstants.MYSQL_TYPE_ENUM: case BinlogConstants.MYSQL_TYPE_STRING: type = meta0; length = meta1; break; default: throw new NestableRuntimeException("assertion failed, unknown column type: " + type); } } } if (!usedColumns.get(i)) { unusedColumnCount++; continue; } else if (nullColumns.get(i - unusedColumnCount)) { columns.add(NullColumn.valueOf(type)); continue; } int value = 0; switch (type) { case BinlogConstants.MYSQL_TYPE_TINY: value = PacketUtils.readInt(buf, 1); value = (value << 24) >> 24; columns.add(TinyColumn.valueOf(value)); break; case BinlogConstants.MYSQL_TYPE_SHORT: value = PacketUtils.readInt(buf, 2); value = (value << 16) >> 16; columns.add(ShortColumn.valueOf(value)); break; case BinlogConstants.MYSQL_TYPE_INT24: value = PacketUtils.readInt(buf, 3); value = (value << 8) >> 8; columns.add(Int24Column.valueOf(value)); break; case BinlogConstants.MYSQL_TYPE_INT: columns.add(IntColumn.valueOf(PacketUtils.readInt(buf, 4))); break; case BinlogConstants.MYSQL_TYPE_LONGLONG: columns.add(LongLongColumn.valueOf(PacketUtils.readLong(buf, 8))); break; case BinlogConstants.MYSQL_TYPE_FLOAT: columns.add(FloatColumn.valueOf(Float.intBitsToFloat(PacketUtils.readInt(buf, 4)))); break; case BinlogConstants.MYSQL_TYPE_DOUBLE: columns.add(DoubleColumn.valueOf(Double.longBitsToDouble(PacketUtils.readLong(buf, 8)))); break; case BinlogConstants.MYSQL_TYPE_YEAR: columns.add(YearColumn.valueOf(MySQLUtils.toYear((short) PacketUtils.readInt(buf, 1)))); break; case BinlogConstants.MYSQL_TYPE_DATE: columns.add(DateColumn.valueOf(MySQLUtils.toDate(PacketUtils.readInt(buf, 3)))); break; case BinlogConstants.MYSQL_TYPE_TIME: columns.add(TimeColumn.valueOf(MySQLUtils.toTime(PacketUtils.readInt(buf, 3)))); break; case BinlogConstants.MYSQL_TYPE_TIMESTAMP: columns.add(TimestampColumn.valueOf(PacketUtils.readLong(buf, 4))); break; case BinlogConstants.MYSQL_TYPE_DATETIME: columns.add(DatetimeColumn.valueOf(MySQLUtils.toDatetime(PacketUtils.readLong(buf, 8)))); break; case BinlogConstants.MYSQL_TYPE_ENUM: columns.add(EnumColumn.valueOf(PacketUtils.readInt(buf, length))); break; case BinlogConstants.MYSQL_TYPE_SET: columns.add(SetColumn.valueOf(PacketUtils.readLong(buf, length))); break; case BinlogConstants.MYSQL_TYPE_STRING: final int stringLength = length < 256 ? PacketUtils.readInt(buf, 1) : PacketUtils.readInt(buf, 2); columns.add(StringColumn.valueOf(PacketUtils.readBytes(buf, stringLength))); break; case BinlogConstants.MYSQL_TYPE_BIT: final int bitLength = (meta >> 8) * 8 + (meta & 0xFF); columns.add(BitColumn.valueOf(bitLength, PacketUtils.readBit(buf, bitLength, false))); break; case BinlogConstants.MYSQL_TYPE_NEWDECIMAL: final int precision = meta & 0xFF; final int scale = meta >> 8; final int decimalLength = MySQLUtils.getDecimalBinarySize(precision, scale); columns.add(DecimalColumn.valueOf( MySQLUtils.toDecimal(precision, scale, PacketUtils.readBytes(buf, decimalLength)), precision, scale)); break; case BinlogConstants.MYSQL_TYPE_BLOB: final int blobLength = PacketUtils.readInt(buf, meta); columns.add(BlobColumn.valueOf(PacketUtils.readBytes(buf, blobLength))); break; case BinlogConstants.MYSQL_TYPE_VARCHAR: case BinlogConstants.MYSQL_TYPE_VAR_STRING: final int varcharLength = meta < 256 ? PacketUtils.readInt(buf, 1) : PacketUtils.readInt(buf, 2); columns.add(StringColumn.valueOf(PacketUtils.readBytes(buf, varcharLength))); break; case BinlogConstants.MYSQL_TYPE_TIME2: final int timeValue = PacketUtils.readInt(buf, 3, false); final int timeNanos = PacketUtils.readInt(buf, (meta + 1) / 2, false); columns.add(Time2Column.valueOf(MySQLUtils.toTime2(timeValue, timeNanos, meta))); break; case BinlogConstants.MYSQL_TYPE_DATETIME2: final long dateTimeValue = PacketUtils.readLong(buf, 5, false); final int dateTimenanos = PacketUtils.readInt(buf, (meta + 1) / 2, false); columns.add(Datetime2Column.valueOf(MySQLUtils.toDatetime2(dateTimeValue, dateTimenanos, meta))); break; case BinlogConstants.MYSQL_TYPE_TIMESTAMP2: final long timeStampValue = PacketUtils.readLong(buf, 4, false); final int timeStampNanos = PacketUtils.readInt(buf, (meta + 1) / 2, false); columns.add( Timestamp2Column.valueOf(MySQLUtils.toTimestamp2(timeStampValue, timeStampNanos, meta))); break; default: throw new NestableRuntimeException("assertion failed, unknown column type: " + type); } } return new Row(columns); }