congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ByteStreamArray.longToVarInt64
Code IndexAdd Tabnine to your IDE (free)

How to use
longToVarInt64
method
in
com.moz.fiji.schema.util.ByteStreamArray

Best Java code snippets using com.moz.fiji.schema.util.ByteStreamArray.longToVarInt64 (Showing top 4 results out of 315)

origin: com.moz.fiji.schema/fiji-schema

/**
 * Serializes a long integer into bytes using the zig-zag variable-length encoding scheme.
 *
 * @param number Long integer to encode.
 * @return Zig-zag encoded long, as an array of up to 10 bytes.
 */
public static byte[] longToZigZagVarInt64(long number) {
 // Zig-zag encode: move sign to low-order bit, and flip others if negative
 number = (number << 1) ^ (number >> 63);
 return longToVarInt64(number);
}
origin: com.moz.fiji.schema/fiji-schema

 /** {@inheritDoc} */
 @Override
 public void encode(final Schema writerSchema) throws IOException {
  final long schemaId = mCellSpec.getSchemaTable().getOrCreateSchemaId(writerSchema);
  mByteArrayEncoder.writeFixed(ByteStreamArray.longToVarInt64(schemaId));
 }
}
origin: com.moz.fiji.schema/fiji-schema

/**
 * Fetches a schema entry from the tables given a schema ID.
 *
 * @param schemaId schema ID
 * @return Avro schema entry, or null if the schema ID does not exist in the table
 * @throws IOException on I/O error.
 */
private SchemaTableEntry loadFromIdTable(long schemaId) throws IOException {
 final Get get = new Get(longToVarInt64(schemaId));
 final Result result = mSchemaIdTable.get(get);
 return result.isEmpty() ? null : decodeSchemaEntry(result.value());
}
origin: com.moz.fiji.schema/fiji-schema

/**
 * Writes the given schema entry to the ID and hash tables.
 *
 * This is not protected from concurrent writes. Caller must ensure consistency.
 *
 * @param avroEntry Schema entry to write.
 * @param timestamp Write entries with this timestamp.
 * @param flush Whether to flush tables synchronously.
 * @throws IOException on I/O error.
 */
private void storeInTable(final SchemaTableEntry avroEntry, long timestamp, boolean flush)
  throws IOException {
 final byte[] entryBytes = encodeSchemaEntry(avroEntry);
 // Writes the ID mapping first: if the hash table write fails, we just lost one schema ID.
 // The hash table write must not happen before the ID table write has been persisted.
 // Otherwise, another client may see the hash entry, write cells with the schema ID that cannot
 // be decoded (since the ID mapping has not been written yet).
 final Put putId = new Put(longToVarInt64(avroEntry.getId()))
   .add(SCHEMA_COLUMN_FAMILY_BYTES, SCHEMA_COLUMN_QUALIFIER_BYTES, timestamp, entryBytes);
 mSchemaIdTable.put(putId);
 if (flush) {
  mSchemaIdTable.flushCommits();
 }
 final Put putHash = new Put(avroEntry.getHash().bytes())
   .add(SCHEMA_COLUMN_FAMILY_BYTES, SCHEMA_COLUMN_QUALIFIER_BYTES, timestamp, entryBytes);
 mSchemaHashTable.put(putHash);
 if (flush) {
  mSchemaHashTable.flushCommits();
 }
}
com.moz.fiji.schema.utilByteStreamArraylongToVarInt64

Javadoc

Serializes a long integer into bytes using the zig-zag variable-length encoding scheme.

Popular methods of ByteStreamArray

  • <init>
    Constructs a new stream of byte.
  • getOffset
  • readBytes
    Reads the specified number of bytes in the stream.
  • readVarInt64
    Reads a variable-length zig-zag encoded signed integer up to 64 bits.
  • sizeOfLongAsVarInt64
    Reports the size of the zig-zag encoding of the specified long integer.

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setScale (BigDecimal)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • JList (javax.swing)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now