Tabnine Logo
ByteConsumer
Code IndexAdd Tabnine to your IDE (free)

How to use
ByteConsumer
in
com.ociweb.pronghorn.util

Best Java code snippets using com.ociweb.pronghorn.util.ByteConsumer (Showing top 20 results out of 315)

origin: oci-pronghorn/Pronghorn

@Override
public void consume(byte value) {
  target.consume(value);
}
origin: com.ociweb/pronghorn-pipes

@Override
public void consume(byte value) {
  target.consume(value);
}
origin: com.ociweb/PronghornPipes

@Override
public void consume(byte value) {
  target.consume(value);
}
origin: oci-pronghorn/Pronghorn

private static <S extends MessageSchema> void rareEncodeCase(int c, ByteConsumer target) {
  if (c < 0x1FFFFF) {
    // code point 21
    target.consume( (byte) (0xF0 | ((c >> 18) & 0x07)));
  } else {
    if (c < 0x3FFFFFF) {
      // code point 26
      target.consume((byte) (0xF8 | ((c >> 24) & 0x03)));
    } else {
      if (c < 0x7FFFFFFF) {
        // code point 31
        target.consume( (byte) (0xFC | ((c >> 30) & 0x01)));
      } else {
        throw new UnsupportedOperationException("can not encode char with value: " + c);
      }
      target.consume( (byte) (0x80 | ((c >> 24) & 0x3F)));
    }
    target.consume( (byte) (0x80 | ((c >> 18) & 0x3F)));
  }
  target.consume((byte) (0x80 | ((c >> 12) & 0x3F)));
}

origin: com.ociweb/pronghorn-pipes

private static <S extends MessageSchema> void rareEncodeCase(int c, ByteConsumer target) {
  if (c < 0x1FFFFF) {
    // code point 21
    target.consume( (byte) (0xF0 | ((c >> 18) & 0x07)));
  } else {
    if (c < 0x3FFFFFF) {
      // code point 26
      target.consume((byte) (0xF8 | ((c >> 24) & 0x03)));
    } else {
      if (c < 0x7FFFFFFF) {
        // code point 31
        target.consume( (byte) (0xFC | ((c >> 30) & 0x01)));
      } else {
        throw new UnsupportedOperationException("can not encode char with value: " + c);
      }
      target.consume( (byte) (0x80 | ((c >> 24) & 0x3F)));
    }
    target.consume( (byte) (0x80 | ((c >> 18) & 0x3F)));
  }
  target.consume((byte) (0x80 | ((c >> 12) & 0x3F)));
}

origin: com.ociweb/PronghornPipes

private static <S extends MessageSchema> void rareEncodeCase(int c, ByteConsumer target) {
  if (c < 0x1FFFFF) {
    // code point 21
    target.consume( (byte) (0xF0 | ((c >> 18) & 0x07)));
  } else {
    if (c < 0x3FFFFFF) {
      // code point 26
      target.consume((byte) (0xF8 | ((c >> 24) & 0x03)));
    } else {
      if (c < 0x7FFFFFFF) {
        // code point 31
        target.consume( (byte) (0xFC | ((c >> 30) & 0x01)));
      } else {
        throw new UnsupportedOperationException("can not encode char with value: " + c);
      }
      target.consume( (byte) (0x80 | ((c >> 24) & 0x3F)));
    }
    target.consume( (byte) (0x80 | ((c >> 18) & 0x3F)));
  }
  target.consume((byte) (0x80 | ((c >> 12) & 0x3F)));
}
 
origin: com.ociweb/pronghorn-pipes

private static <S extends MessageSchema> void encodeSingleChar(int c, ByteConsumer target) {
  if (c <= 0x007F) { // less than or equal to 7 bits or 127
    // code point 7
    target.consume( (byte) c);
  } else {
    if (c <= 0x07FF) { // less than or equal to 11 bits or 2047
      // code point 11
      target.consume( (byte) (0xC0 | ((c >> 6) & 0x1F)));
    } else {
      if (c <= 0xFFFF) { // less than or equal to  16 bits or 65535
        //special case logic here because we know that c > 7FF and c <= FFFF so it may hit these
        // D800 through DFFF are reserved for UTF-16 and must be encoded as an 63 (error)
        if (0xD800 == (0xF800&c)) {
          target.consume( (byte)63 );
          return;
        }
        // code point 16
        target.consume( (byte) (0xE0 | ((c >> 12) & 0x0F)));
      } else {
        rareEncodeCase(c, target);
      }
      target.consume( (byte) (0x80 | ((c >> 6) & 0x3F)));
    }
    target.consume( (byte) (0x80 | (c & 0x3F)));
  }
}
origin: com.ociweb/PronghornPipes

private static <S extends MessageSchema> void encodeSingleChar(int c, ByteConsumer target) {
  if (c <= 0x007F) { // less than or equal to 7 bits or 127
    // code point 7
    target.consume( (byte) c);
  } else {
    if (c <= 0x07FF) { // less than or equal to 11 bits or 2047
      // code point 11
      target.consume( (byte) (0xC0 | ((c >> 6) & 0x1F)));
    } else {
      if (c <= 0xFFFF) { // less than or equal to  16 bits or 65535
        //special case logic here because we know that c > 7FF and c <= FFFF so it may hit these
        // D800 through DFFF are reserved for UTF-16 and must be encoded as an 63 (error)
        if (0xD800 == (0xF800&c)) {
          target.consume( (byte)63 );
          return;
        }
        // code point 16
        target.consume( (byte) (0xE0 | ((c >> 12) & 0x0F)));
      } else {
        rareEncodeCase(c, target);
      }
      target.consume( (byte) (0x80 | ((c >> 6) & 0x3F)));
    }
    target.consume( (byte) (0x80 | (c & 0x3F)));
  }
}
origin: com.ociweb/PronghornPipes

public static int capturedFieldBytes(TrieParserReader reader, int idx, ByteConsumer target) {
  assert(null!=reader);
  assert(null!=target);
  int pos = idx*4;
  assert(pos < reader.capturedValues.length) : "Either the idx argument is too large or TrieParseReader was not constructed to hold this many fields";
  int type = reader.capturedValues[pos++];
  assert(type==0);
  int bpos = reader.capturedValues[pos++];
  int blen = reader.capturedValues[pos++];
  int bmsk = reader.capturedValues[pos++];
  try {
    target.consume(reader.capturedBlobArray, bpos, blen, bmsk);
  } catch (Throwable t) {
    t.printStackTrace();
  }
  return blen;
}
origin: com.ociweb/pronghorn-pipes

public static int capturedFieldBytes(TrieParserReader reader, int idx, ByteConsumer target) {
  assert(null!=reader);
  assert(null!=target);
  int pos = idx*4;
  assert(pos < reader.capturedValues.length) : "Either the idx argument is too large or TrieParseReader was not constructed to hold this many fields";
  int type = reader.capturedValues[pos++];
  assert(type==0);
  int bpos = reader.capturedValues[pos++];
  int blen = reader.capturedValues[pos++];
  int bmsk = reader.capturedValues[pos++];
  try {
    target.consume(reader.capturedBlobArray, bpos, blen, bmsk);
  } catch (Throwable t) {
    t.printStackTrace();
  }
  return blen;
}
origin: oci-pronghorn/Pronghorn

public static int capturedFieldBytes(TrieParserReader reader, int idx, ByteConsumer target) {
  assert(null!=reader);
  assert(null!=target);
  int pos = idx*4;
  assert(pos < reader.capturedValues.length) : "Either the idx argument is too large or TrieParseReader was not constructed to hold this many fields";
  int type = reader.capturedValues[pos++];
  assert(type==0);
  int bpos = reader.capturedValues[pos++];
  int blen = reader.capturedValues[pos++];
  int bmsk = reader.capturedValues[pos++];
  try {
    target.consume(reader.capturedBlobArray, bpos, blen, bmsk);
  } catch (Throwable t) {
    t.printStackTrace();
  }
  return blen;
}
origin: oci-pronghorn/Pronghorn

private static <S extends MessageSchema> void encodeSingleChar(int c, ByteConsumer target) {
  if (c <= 0x007F) { // less than or equal to 7 bits or 127
    // code point 7
    target.consume( (byte) c);
  } else {
    if (c <= 0x07FF) { // less than or equal to 11 bits or 2047
      // code point 11
      target.consume( (byte) (0xC0 | ((c >> 6) & 0x1F)));
    } else {
      if (c <= 0xFFFF) { // less than or equal to  16 bits or 65535
        //special case logic here because we know that c > 7FF and c <= FFFF so it may hit these
        // D800 through DFFF are reserved for UTF-16 and must be encoded as an 63 (error)
        if (0xD800 == (0xF800&c)) {
          target.consume( (byte)63 );
          return;
        }
        // code point 16
        target.consume( (byte) (0xE0 | ((c >> 12) & 0x0F)));
      } else {
        rareEncodeCase(c, target);
      }
      target.consume( (byte) (0x80 | ((c >> 6) & 0x3F)));
    }
    target.consume( (byte) (0x80 | (c & 0x3F)));
  }
}
origin: com.ociweb/PronghornPipes

       } else {
         logger.warn("unable to decode unicode");
         target.consume((byte)0xFF);//replacement char to show that an error happened.
        target.consume((byte)0xFD);
        return;
   target.consume((byte)0xFF);//replacement char to show that an error happened.
  target.consume((byte)0xFD);
  target.consume((byte)0xFF);//replacement char to show that an error happened.
  target.consume((byte)0xFD);
  high10 = -1;
  return;
target.consume(backing,pos,len,mask);
origin: oci-pronghorn/Pronghorn

       } else {
         logger.warn("unable to decode unicode");
         target.consume((byte)0xFF);//replacement char to show that an error happened.
        target.consume((byte)0xFD);
        return;
   target.consume((byte)0xFF);//replacement char to show that an error happened.
  target.consume((byte)0xFD);
  target.consume((byte)0xFF);//replacement char to show that an error happened.
  target.consume((byte)0xFD);
  high10 = -1;
  return;
target.consume(backing,pos,len,mask);
origin: com.ociweb/pronghorn-pipes

       } else {
         logger.warn("unable to decode unicode");
         target.consume((byte)0xFF);//replacement char to show that an error happened.
        target.consume((byte)0xFD);
        return;
   target.consume((byte)0xFF);//replacement char to show that an error happened.
  target.consume((byte)0xFD);
  target.consume((byte)0xFF);//replacement char to show that an error happened.
  target.consume((byte)0xFD);
  high10 = -1;
  return;
target.consume(backing,pos,len,mask);
origin: oci-pronghorn/Pronghorn

private static <A extends Appendable> boolean consumeEscapedString(TrieParserReader reader, long stringId, ByteConsumer target) {
  
  TrieParserReader.capturedFieldBytes(reader, 0, target);
  if (STRING_END != (0xFF&stringId)) {
    do {
      stringId = reader.parseNext(reader, stringEndParser);
      if (-1 == stringId) {
        throw new UnsupportedOperationException("Unable to parse text string");
      }        
      target.consume((byte)(stringId>>8));
      TrieParserReader.capturedFieldBytes(reader, 0, target);
      
    } while (STRING_END != (0xFF&stringId));
  }
  
  return true;
}

origin: com.ociweb/pronghorn-pipes

private static <A extends Appendable> boolean consumeEscapedString(TrieParserReader reader, long stringId, ByteConsumer target) {
  
  TrieParserReader.capturedFieldBytes(reader, 0, target);
  if (STRING_END != (0xFF&stringId)) {
    do {
      stringId = reader.parseNext(reader, stringEndParser);
      if (-1 == stringId) {
        throw new UnsupportedOperationException("Unable to parse text string");
      }        
      target.consume((byte)(stringId>>8));
      TrieParserReader.capturedFieldBytes(reader, 0, target);
      
    } while (STRING_END != (0xFF&stringId));
  }
  
  return true;
}

origin: com.ociweb/PronghornPipes

private static <A extends Appendable> boolean consumeEscapedString(TrieParserReader reader, long stringId, ByteConsumer target) {
  
  TrieParserReader.capturedFieldBytes(reader, 0, target);
  if (STRING_END != (0xFF&stringId)) {
    do {
      stringId = reader.parseNext(reader, stringEndParser);
      if (-1 == stringId) {
        throw new UnsupportedOperationException("Unable to parse text string");
      }        
      target.consume((byte)(stringId>>8));
      TrieParserReader.capturedFieldBytes(reader, 0, target);
      
    } while (STRING_END != (0xFF&stringId));
  }
  
  return true;
}
 
origin: oci-pronghorn/Pronghorn

visitor.stringAccumulator().consume((byte)value);
TrieParserReader.capturedFieldBytes(reader, 0, visitor.stringAccumulator());				
origin: com.ociweb/PronghornPipes

visitor.stringAccumulator().consume((byte)value);
TrieParserReader.capturedFieldBytes(reader, 0, visitor.stringAccumulator());				
com.ociweb.pronghorn.utilByteConsumer

Most used methods

  • consume

Popular in Java

  • Updating database using SQL prepared statement
  • getSharedPreferences (Context)
  • requestLocationUpdates (LocationManager)
  • runOnUiThread (Activity)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • String (java.lang)
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Top PhpStorm plugins
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