org.apache.jena.atlas.lib.Bytes.setLong()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中org.apache.jena.atlas.lib.Bytes.setLong()方法的一些代码示例,展示了Bytes.setLong()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.setLong()方法的具体详情如下:
包路径:org.apache.jena.atlas.lib.Bytes
类名称:Bytes
方法名:setLong

Bytes.setLong介绍

[英]Put a long into a byte array
[中]

代码示例

代码示例来源:origin: apache/jena

/** Put a long value into an allocated byte array. 
 * @param v
 * @return byte[] array 
 * @see Long#SIZE
 */
public static byte[] longToBytes(long v) {
  byte[] bytes = new byte[Long.BYTES] ;
  setLong(v, bytes); 
  return bytes ;
}

代码示例来源:origin: apache/jena

/** Put a long into a byte array
 * @param value The integer
 * @param b byte array 
 */
public static final void setLong(long value, byte[]b)
{ setLong(value, b, 0) ; }

代码示例来源:origin: apache/jena

/** UUID, as two longs, as bytes */ 
public static byte[] uuidAsBytes(long mostSignificantBits, long leastSignificantBits) {
  byte[] bytes = new byte[16] ;
  Bytes.setLong(mostSignificantBits, bytes, 0); 
  Bytes.setLong(leastSignificantBits, bytes, 8);
  return bytes ;
}

代码示例来源:origin: org.apache.jena/jena-base

/** Put a long value into an allocated byte array. 
 * @param v
 * @return byte[] array 
 * @see Long#SIZE
 */
public static byte[] longToBytes(long v) {
  byte[] bytes = new byte[Long.BYTES] ;
  setLong(v, bytes); 
  return bytes ;
}

代码示例来源:origin: org.seaborne.mantis/dboe-base

/** UUID, as two longs, as bytes */ 
public static byte[] uuidAsBytes(long mostSignificantBits, long leastSignificantBits) {
  byte[] bytes = new byte[16] ;
  Bytes.setLong(mostSignificantBits, bytes, 0); 
  Bytes.setLong(leastSignificantBits, bytes, 8);
  return bytes ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

/** long to byte array */
public static byte[] packLong(long val)
{
  byte[] valBytes = new byte[Long.SIZE/Byte.SIZE] ;
  setLong(val, valBytes, 0) ;
  return valBytes ;
}

代码示例来源:origin: org.apache.jena/jena-base

/** long to byte array */
public static byte[] packLong(long val) {
  byte[] valBytes = new byte[Long.SIZE / Byte.SIZE] ;
  setLong(val, valBytes, 0) ;
  return valBytes ;
}

代码示例来源:origin: apache/jena

/** long to byte array */
public static byte[] packLong(long val) {
  byte[] valBytes = new byte[Long.SIZE / Byte.SIZE] ;
  setLong(val, valBytes, 0) ;
  return valBytes ;
}

代码示例来源:origin: org.apache.jena/jena-base

/** Put a long into a byte array
 * @param value The integer
 * @param b byte array 
 */
public static final void setLong(long value, byte[]b)
{ setLong(value, b, 0) ; }

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

/** Put a long into a byte array
 * @param value The integer
 * @param b byte array 
 */
public static final void setLong(long value, byte[]b)
{ setLong(value, b, 0) ; }

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

@Override
public void reset() {
  UUID seed = this.freshSeed();
  seedBytes = new byte[128 / 8] ;
  Bytes.setLong(seed.getMostSignificantBits(), seedBytes, 0) ;
  Bytes.setLong(seed.getLeastSignificantBits(), seedBytes, 8) ;
}

代码示例来源:origin: apache/jena

@Override
public Node create() {
  counter++;
  // Make illegal string bytes so can't clash with alloc(String).
  // It is different because it has zeros in it.
  counterBytes[0] = 0;
  counterBytes[1] = 0;
  Bytes.setLong(counter, counterBytes, 2);
  return alloc(counterBytes);
}

代码示例来源:origin: apache/jena

/** Not relative - set at position zero */
public static void set(NodeId nodeId, byte[] b) {
  long v2 = encode(nodeId);
  Bytes.setLong(v2, b, 0);
}

代码示例来源:origin: apache/jena

@Override
public void reset() {
  UUID seed = this.freshSeed();
  seedBytes = new byte[128 / 8];
  Bytes.setLong(seed.getMostSignificantBits(), seedBytes, 0);
  Bytes.setLong(seed.getLeastSignificantBits(), seedBytes, 8);
  if ( cache != null )
    cache.clear();
}

代码示例来源:origin: apache/jena

public static void set(NodeId nodeId, byte[] b, int idx) {
  long v2 = encode(nodeId);
  Bytes.setLong(v2, b, idx);
}

代码示例来源:origin: apache/jena

public static void setNext(NodeId nodeId, byte[] b, int idx) {
  long v2 = encode(nodeId);
  Bytes.setLong(v2+1, b, idx);
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

@Override
public Node create() {
  counter++ ;
  // Make illegal string bytes so can't clash with alloc(String)
  counterBytes[0] = 0 ;
  counterBytes[1] = 0 ;
  Bytes.setLong(counter, counterBytes, 2) ;
  return alloc(counterBytes) ;
}

代码示例来源:origin: apache/jena

public static Record record(RecordFactory factory, Tuple<NodeId> tuple, ColumnMap cMap) 
  {
    byte[] b = new byte[tuple.len()*NodeId.SIZE] ;
    for ( int i = 0 ; i < tuple.len() ; i++ )
    {
      int j = cMap.mapSlotIdx(i) ;
      // i'th Nodeid goes to j'th bytes slot.
      Bytes.setLong(tuple.get(i).getId(), b,j*SizeOfLong) ;
    }
      
    return factory.create(b) ;
  }
}

代码示例来源:origin: apache/jena

@Test public void packLong8()
{
  byte[] b = new byte[16] ;
  Bytes.setLong(0xF1F2F3F4F5F6F7F8L,b,0) ;
  Bytes.setLong(0xA1A2A3A4A5A6A7A8L,b,8) ;
  long i1 = Bytes.getLong(b,0) ;
  long i2 = Bytes.getLong(b,8) ;
  assertEquals(0xF1F2F3F4F5F6F7F8L,i1) ;
  assertEquals(0xA1A2A3A4A5A6A7A8L,i2) ;
}

代码示例来源:origin: apache/jena

@Test public void packLong7()
{
  byte[] b = new byte[8] ;
  Bytes.setLong(0xF1F2F3F4F5F6F7F8L,b) ;
  long i = Bytes.getLong(b) ;
  assertEquals (0xF1F2F3F4F5F6F7F8L,i) ;
}

相关文章