Java Code Examples for io.vertx.core.parsetools.RecordParser#fixedSizeMode()

The following examples show how to use io.vertx.core.parsetools.RecordParser#fixedSizeMode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DatabaseReader.java    From vertx-in-action with MIT License 5 votes vote down vote up
private static void finishEntry(String key, Buffer valueLength, RecordParser parser) {
  parser.fixedSizeMode(valueLength.getInt(0));
  parser.handler(value -> {
    logger.info("Key: {} / Value: {}", key, value);
    parser.fixedSizeMode(4);
    parser.handler(keyLength -> readKey(keyLength, parser));
  });
}
 
Example 2
Source File: FetchDatabaseReader.java    From vertx-in-action with MIT License 5 votes vote down vote up
private static void finishEntry(String key, Buffer valueLength, RecordParser parser) {
  parser.fixedSizeMode(valueLength.getInt(0));
  parser.handler(value -> {
    logger.info("Key: {} / Value: {}", key, value);
    parser.fixedSizeMode(4);
    parser.handler(keyLength -> readKey(keyLength, parser));
    parser.fetch(1);
  });
  parser.fetch(1);
}
 
Example 3
Source File: DatabaseReader.java    From vertx-in-action with MIT License 4 votes vote down vote up
private static void readName(Buffer name, RecordParser parser) {
  logger.info("Name: {}", name.toString());
  parser.fixedSizeMode(4);
  parser.handler(keyLength -> readKey(keyLength, parser));
}
 
Example 4
Source File: DatabaseReader.java    From vertx-in-action with MIT License 4 votes vote down vote up
private static void readKey(Buffer keyLength, RecordParser parser) {
  parser.fixedSizeMode(keyLength.getInt(0));
  parser.handler(key -> readValue(key.toString(), parser));
}
 
Example 5
Source File: DatabaseReader.java    From vertx-in-action with MIT License 4 votes vote down vote up
private static void readValue(String key, RecordParser parser) {
  parser.fixedSizeMode(4);
  parser.handler(valueLength -> finishEntry(key, valueLength, parser));
}
 
Example 6
Source File: FetchDatabaseReader.java    From vertx-in-action with MIT License 4 votes vote down vote up
private static void readName(Buffer name, RecordParser parser) {
  logger.info("Name: {}", name.toString());
  parser.fixedSizeMode(4);
  parser.handler(keyLength -> readKey(keyLength, parser));
  parser.fetch(1);
}
 
Example 7
Source File: FetchDatabaseReader.java    From vertx-in-action with MIT License 4 votes vote down vote up
private static void readKey(Buffer keyLength, RecordParser parser) {
  parser.fixedSizeMode(keyLength.getInt(0));
  parser.handler(key -> readValue(key.toString(), parser));
  parser.fetch(1);
}
 
Example 8
Source File: FetchDatabaseReader.java    From vertx-in-action with MIT License 4 votes vote down vote up
private static void readValue(String key, RecordParser parser) {
  parser.fixedSizeMode(4);
  parser.handler(valueLength -> finishEntry(key, valueLength, parser));
  parser.fetch(1);
}