Tabnine Logo
SchemaSerializationException.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.apache.pulsar.client.api.SchemaSerializationException
constructor

Best Java code snippets using org.apache.pulsar.client.api.SchemaSerializationException.<init> (Showing top 20 results out of 315)

origin: apache/pulsar

@Override
public void validate(byte[] message) {
  if (message.length != 2) {
    throw new SchemaSerializationException("Size of data received by ShortSchema is not 2");
  }
}
origin: apache/pulsar

@Override
public void validate(byte[] message) {
  if (message.length != 1) {
    throw new SchemaSerializationException("Size of data received by ByteSchema is not 1");
  }
}
origin: apache/pulsar

@Override
public void validate(byte[] message) {
  if (message.length != 8) {
    throw new SchemaSerializationException("Size of data received by LongSchema is not 8");
  }
}
origin: apache/pulsar

@Override
public void validate(byte[] message) {
  if (message.length != 8) {
    throw new SchemaSerializationException("Size of data received by DoubleSchema is not 8");
  }
}
origin: apache/pulsar

@Override
public void validate(byte[] message) {
  if (message.length != 4) {
    throw new SchemaSerializationException("Size of data received by FloatSchema is not 4");
  }
}
origin: apache/pulsar

@Override
public void validate(byte[] message) {
  if (message.length != 1) {
    throw new SchemaSerializationException("Size of data received by BooleanSchema is not 1");
  }
}
origin: apache/pulsar

@Override
public void validate(byte[] message) {
  if (message.length != 4) {
    throw new SchemaSerializationException("Size of data received by IntSchema is not 4");
  }
}
origin: apache/pulsar

@Override
public byte[] encode(T message) throws SchemaSerializationException {
  try {
    return objectMapper.writeValueAsBytes(message);
  } catch (JsonProcessingException e) {
    throw new SchemaSerializationException(e);
  }
}
origin: apache/pulsar

@Override
public T decode(byte[] bytes) {
  try {
    return this.tParser.parseFrom(bytes);
  } catch (Exception e) {
    throw new RuntimeException(new SchemaSerializationException(e));
  }
}
origin: apache/pulsar

@Override
public T decode(byte[] bytes) {
  try {
    return objectMapper.readValue(bytes, this.pojo);
  } catch (IOException e) {
    throw new SchemaSerializationException(e);
  }
}
origin: apache/pulsar

@Override
public byte[] encode(GenericRecord message) {
  checkArgument(message instanceof GenericAvroRecord);
  GenericJsonRecord gjr = (GenericJsonRecord) message;
  try {
    return objectMapper.writeValueAsBytes(gjr.getJsonNode().toString());
  } catch (IOException ioe) {
    throw new SchemaSerializationException(ioe);
  }
}
origin: apache/pulsar

  @Override
  public GenericRecord decode(byte[] bytes) {
    try {
      JsonNode jn = objectMapper.readTree(new String(bytes, UTF_8));
      return new GenericJsonRecord(fields, jn);
    } catch (IOException ioe) {
      throw new SchemaSerializationException(ioe);
    }
  }
}
origin: apache/pulsar

@Override
public synchronized byte[] encode(T message) {
  try {
    datumWriter.write(message, this.encoder);
    this.encoder.flush();
    return this.byteArrayOutputStream.toByteArray();
  } catch (Exception e) {
    throw new SchemaSerializationException(e);
  } finally {
    this.byteArrayOutputStream.reset();
  }
}
origin: apache/pulsar

@Override
public T decode(byte[] bytes) {
  try {
    BinaryDecoder decoderFromCache = decoders.get();
    BinaryDecoder decoder = DecoderFactory.get().binaryDecoder(bytes, decoderFromCache);
    if (decoderFromCache == null) {
      decoders.set(decoder);
    }
    return reader.read(null, DecoderFactory.get().binaryDecoder(bytes, decoder));
  } catch (IOException e) {
    throw new SchemaSerializationException(e);
  }
}
origin: apache/pulsar

@Override
public synchronized byte[] encode(GenericRecord message) {
  checkArgument(message instanceof GenericAvroRecord);
  GenericAvroRecord gar = (GenericAvroRecord) message;
  try {
    datumWriter.write(gar.getAvroRecord(), this.encoder);
    this.encoder.flush();
    return this.byteArrayOutputStream.toByteArray();
  } catch (Exception e) {
    throw new SchemaSerializationException(e);
  } finally {
    this.byteArrayOutputStream.reset();
  }
}
origin: apache/pulsar

@Override
public GenericRecord decode(byte[] bytes) {
  try {
    Decoder decoder = DecoderFactory.get().binaryDecoder(bytes, null);
    org.apache.avro.generic.GenericRecord avroRecord = datumReader.read(
      null,
      decoder);
    return new GenericAvroRecord(schema, fields, avroRecord);
  } catch (IOException e) {
    throw new SchemaSerializationException(e);
  }
}
origin: org.apache.pulsar/pulsar-client-schema

@Override
public void validate(byte[] message) {
  if (message.length != 4) {
    throw new SchemaSerializationException("Size of data received by FloatSchema is not 4");
  }
}
origin: org.apache.pulsar/pulsar-client-schema

@Override
public void validate(byte[] message) {
  if (message.length != 4) {
    throw new SchemaSerializationException("Size of data received by IntSchema is not 4");
  }
}
origin: org.apache.pulsar/pulsar-client-schema

@Override
public byte[] encode(GenericRecord message) {
  checkArgument(message instanceof GenericAvroRecord);
  GenericJsonRecord gjr = (GenericJsonRecord) message;
  try {
    return objectMapper.writeValueAsBytes(gjr.getJsonNode().toString());
  } catch (IOException ioe) {
    throw new RuntimeException(new SchemaSerializationException(ioe));
  }
}
origin: org.apache.pulsar/pulsar-client-schema

@Override
public T decode(byte[] bytes) {
  try {
    return reader.read(null, DecoderFactory.get().binaryDecoder(bytes, null));
  } catch (IOException e) {
    throw new SchemaSerializationException(e);
  }
}
org.apache.pulsar.client.apiSchemaSerializationException<init>

Popular methods of SchemaSerializationException

  • getMessage

Popular in Java

  • Creating JSON documents from java classes using gson
  • requestLocationUpdates (LocationManager)
  • getExternalFilesDir (Context)
  • getContentResolver (Context)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Best IntelliJ 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