本文整理了Java中java.util.BitSet.valueOf()
方法的一些代码示例,展示了BitSet.valueOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BitSet.valueOf()
方法的具体详情如下:
包路径:java.util.BitSet
类名称:BitSet
方法名:valueOf
[英]Returns a BitSet corresponding to byteBuffer, interpreted as a little-endian sequence of bits. This method does not alter the ByteBuffer.
[中]返回与byteBuffer相对应的位集,该位集被解释为一个小的字节序列。此方法不会改变ByteBuffer。
代码示例来源:origin: apache/incubator-druid
public WrappedImmutableBitSetBitmap(ByteBuffer byteBuffer)
{
this(BitSet.valueOf(byteBuffer));
}
代码示例来源:origin: apache/hive
public BitSet getIncludedBuckets() {
return includedBuckets != null ? BitSet.valueOf(includedBuckets) : null;
}
代码示例来源:origin: debezium/debezium
public static BitSet toBitSet(Schema schema, byte[] value) {
return BitSet.valueOf(value);
}
}
代码示例来源:origin: robovm/robovm
/**
* Equivalent to {@code BitSet.valueOf(ByteBuffer.wrap(bytes))}.
* @since 1.7
*/
public static BitSet valueOf(byte[] bytes) {
return BitSet.valueOf(ByteBuffer.wrap(bytes));
}
代码示例来源:origin: ethereum/ethereumj
public BloomFilter(byte[] bloomMask) {
if (bloomMask.length != BLOOM_BYTES) throw new RuntimeException("Invalid bloom filter array length: " + bloomMask.length);
mask = BitSet.valueOf(bloomMask);
}
代码示例来源:origin: ethereum/ethereumj
private int getFirstBitSet(byte[] bytes) {
BitSet b = BitSet.valueOf(bytes);
for (int i = 0; i < b.length(); i++) {
if (b.get(i)) {
return i;
}
}
return 0;
}
代码示例来源:origin: apache/incubator-druid
@Override
public ImmutableBitmap mapImmutableBitmap(ByteBuffer b)
{
return new WrappedBitSetBitmap(BitSet.valueOf(b.array()));
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public BitSet readBitSet() {
long[] arr = readLongArray();
return arr != null ? BitSet.valueOf(arr) : null;
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public BitSet readBitSet() {
long[] arr = readLongArray();
return arr != null ? BitSet.valueOf(arr) : null;
}
代码示例来源:origin: Codecademy/EventHub
@Override
public BloomFilter fromBytes(byte[] bytes) {
ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
byte[] bloomFilter = new byte[bloomFilterSize];
byteBuffer.get(bloomFilter);
return new BloomFilter(numHashes, BitSet.valueOf(bloomFilter));
}
}
代码示例来源:origin: RuedigerMoeller/fast-serialization
@Override
public Object instantiate(Class objectClass, FSTObjectInput in, FSTClazzInfo serializationInfo,
FSTClazzInfo.FSTFieldInfo referencee, int streamPosition) throws Exception {
long[] l = (long[])in.readObject();
Object res = BitSet.valueOf(l);
return res;
}
代码示例来源:origin: apache/ignite
/**
* Checks that feature supported by node.
*
* @param clusterNode Cluster node to check.
* @return {@code True} if feature is declared to be supported by remote node.
*/
public static boolean nodeSupports(ClusterNode clusterNode, IgniteFeatures feature) {
final byte[] features = clusterNode.attribute(ATTR_IGNITE_FEATURES);
return features != null && BitSet.valueOf(features).get(feature.getFeatureId());
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public BitSet fromString(String string) {
if ( string == null || string.isEmpty() ) {
return null;
}
String[] tokens = string.split( DELIMITER );
long[] values = new long[tokens.length];
for ( int i = 0; i < tokens.length; i++ ) {
values[i] = Long.valueOf( tokens[i], 2 );
}
return BitSet.valueOf( values );
}
代码示例来源:origin: apache/kylin
@Override
public ImmutableBitSet deserialize(ByteBuffer in) {
BitSet bitSet = BitSet.valueOf(BytesUtil.readByteArray(in));
return new ImmutableBitSet(bitSet);
}
};
代码示例来源:origin: hibernate/hibernate-orm
@Override
public Object deepCopy(Object value)
throws HibernateException {
return value == null ? null :
BitSet.valueOf( BitSet.class.cast( value ).toLongArray() );
}
代码示例来源:origin: apache/incubator-druid
@Test
public void testOffHeap()
{
ByteBuffer buffer = ByteBuffer.allocateDirect(Long.SIZE * 100 / 8).order(ByteOrder.LITTLE_ENDIAN);
BitSet testSet = BitSet.valueOf(buffer);
testSet.set(1);
WrappedImmutableBitSetBitmap bitMap = new WrappedImmutableBitSetBitmap(testSet);
Assert.assertTrue(bitMap.get(1));
testSet.set(2);
Assert.assertTrue(bitMap.get(2));
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void test() {
BitSet bitSet = BitSet.valueOf( new long[] {1, 2, 3} );
doInHibernate( this::sessionFactory, session -> {
Product product = new Product( );
product.setId( 1 );
product.setBitSet( bitSet );
session.persist( product );
} );
doInHibernate( this::sessionFactory, session -> {
Product product = session.get( Product.class, 1 );
assertEquals(bitSet, product.getBitSet());
} );
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void test() {
//tag::basic-custom-type-BitSetTypeDef-persistence-example[]
BitSet bitSet = BitSet.valueOf( new long[] {1, 2, 3} );
doInHibernate( this::sessionFactory, session -> {
Product product = new Product( );
product.setId( 1 );
product.setBitSet( bitSet );
session.persist( product );
} );
doInHibernate( this::sessionFactory, session -> {
Product product = session.get( Product.class, 1 );
assertEquals(bitSet, product.getBitSet());
} );
//end::basic-custom-type-BitSetTypeDef-persistence-example[]
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void test() {
//tag::basic-custom-type-BitSetType-persistence-example[]
BitSet bitSet = BitSet.valueOf( new long[] {1, 2, 3} );
doInHibernate( this::sessionFactory, session -> {
Product product = new Product( );
product.setId( 1 );
product.setBitSet( bitSet );
session.persist( product );
} );
doInHibernate( this::sessionFactory, session -> {
Product product = session.get( Product.class, 1 );
assertEquals(bitSet, product.getBitSet());
} );
//end::basic-custom-type-BitSetType-persistence-example[]
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testNativeQuery() {
BitSet bitSet = BitSet.valueOf( new long[] {1, 2, 3} );
doInHibernate( this::sessionFactory, session -> {
Product product = new Product( );
product.setId( 1 );
product.setBitSet( bitSet );
session.persist( product );
} );
doInHibernate( this::sessionFactory, session -> {
Product product = (Product) session.getNamedNativeQuery(
"find_person_by_bitset")
.setParameter( "id", 1L)
.getSingleResult();
assertEquals(bitSet, product.getBitSet());
} );
}
内容来源于网络,如有侵权,请联系作者删除!