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

How to use
Message
in
io.protostuff

Best Java code snippets using io.protostuff.Message (Showing top 20 results out of 315)

origin: protostuff/protostuff

public UninitializedMessageException(String msg, Message<?> targetMessage)
{
  this(msg, targetMessage, targetMessage.cachedSchema());
}
origin: protostuff/protostuff

public UninitializedMessageException(Message<?> targetMessage)
{
  this(targetMessage, targetMessage.cachedSchema());
}
origin: protostuff/protostuff

@Override
protected <T> Schema<T> writeMessageIdTo(Output output, int fieldNumber,
    Message<T> message) throws IOException
{
  output.writeString(fieldNumber, message.getClass().getName(), false);
  return message.cachedSchema();
}
origin: protostuff/protostuff

@Override
protected <T> Schema<T> writeMessageIdTo(Output output, int fieldNumber,
    Message<T> message) throws IOException
{
  output.writeString(fieldNumber, message.getClass().getName(), false);
  return message.cachedSchema();
}
origin: protostuff/protostuff

/**
 * Serializes the {@code message} into an {@link OutputStream} via {@link JsonXOutput} with the supplied buffer.
 */
public static <T extends Message<T>> void writeTo(OutputStream out, T message, boolean numeric,
    LinkedBuffer buffer)
    throws IOException
{
  writeTo(out, message, message.cachedSchema(), numeric, buffer);
}
origin: protostuff/protostuff

/**
 * Serializes the {@code message} into an {@link OutputStream} via {@link MsgpackXOutput} with the supplied buffer.
 */
public static <T extends Message<T>> void writeTo(OutputStream out, T message, boolean numeric,
    LinkedBuffer buffer)
    throws IOException
{
  writeTo(out, message, message.cachedSchema(), numeric, buffer);
}
origin: protostuff/protostuff

@Override
@SuppressWarnings("unchecked")
protected <T> Schema<T> writeMessageIdTo(Output output, int fieldNumber,
    Message<T> message) throws IOException
{
  final BaseHS<T> wrapper = (BaseHS<T>) pojoMapping.get(message.getClass());
  if (wrapper == null)
    throw new UnknownTypeException("pojo: " + message.getClass());
  output.writeUInt32(fieldNumber, wrapper.id, false);
  // TODO allow the wrapper to return an override schema?
  return message.cachedSchema();
}
origin: protostuff/protostuff

static <T extends Message<T>> Schema<T> getCachedSchema(Class<T> clazz)
    throws InstantiationException, IllegalAccessException
{
  Schema<T> schema = clazz.newInstance().cachedSchema();
  // System.err.println("! " + schema + " | " +
  // System.identityHashCode(schema));
  return schema;
}
origin: protostuff/protostuff

@Override
@SuppressWarnings("unchecked")
protected <T> Schema<T> writeMessageIdTo(Output output, int fieldNumber,
    Message<T> message) throws IOException
{
  int id;
  BaseHS<T> wrapper = (BaseHS<T>) getSchemaWrapper(message.getClass(), true);
  // wait till everything is completely set
  while (0 == (id = wrapper.id))
    LockSupport.parkNanos(1);
  output.writeUInt32(fieldNumber, id, false);
  // TODO allow the wrapper to return an override schema?
  return message.cachedSchema();
}
origin: protostuff/protostuff

@Override
@SuppressWarnings("unchecked")
public Schema<T> getSchema()
{
  Schema<T> schema = this.schema;
  if (schema == null)
  {
    synchronized (this)
    {
      if ((schema = this.schema) == null)
      {
        if (Message.class.isAssignableFrom(typeClass))
        {
          // use the message's schema.
          Message<T> m = (Message<T>) createMessageInstance(typeClass);
          this.schema = schema = m.cachedSchema();
        }
        else
        {
          // create new
          this.schema = schema = strategy
              .newSchema(typeClass);
        }
      }
    }
  }
  return schema;
}
origin: protostuff/protostuff

@Override
@SuppressWarnings("unchecked")
public Schema<T> getSchema()
{
  Schema<T> schema = this.schema;
  if (schema == null)
  {
    synchronized (this)
    {
      if ((schema = this.schema) == null)
      {
        if (Message.class.isAssignableFrom(typeClass))
        {
          // use the message's schema.
          final Message<T> m = (Message<T>) createMessageInstance(typeClass);
          this.schema = schema = m.cachedSchema();
        }
        else
        {
          // create new
          this.schema = schema = strategy.newSchema(typeClass);
        }
      }
    }
  }
  return schema;
}
origin: protostuff/protostuff

@Override
@SuppressWarnings("unchecked")
public Schema<T> getSchema()
{
  Schema<T> schema = this.schema;
  if (schema == null)
  {
    synchronized (this)
    {
      if ((schema = this.schema) == null)
      {
        if (Message.class.isAssignableFrom(typeClass))
        {
          // use the message's schema.
          final Message<T> m = (Message<T>) createMessageInstance(typeClass);
          this.schema = schema = m.cachedSchema();
        }
        else
        {
          // create new
          this.schema = schema = strategy.newSchema(typeClass);
        }
      }
    }
  }
  return schema;
}
origin: protostuff/protostuff

@Override
@SuppressWarnings("unchecked")
public Schema<T> getSchema()
{
  Schema<T> schema = this.schema;
  if (schema == null)
  {
    synchronized (this)
    {
      if ((schema = this.schema) == null)
      {
        if (Message.class.isAssignableFrom(typeClass))
        {
          // use the message's schema.
          Message<T> m = (Message<T>) createMessageInstance(typeClass);
          this.schema = schema = m.cachedSchema();
        }
        else
        {
          // create new
          this.schema = schema = strategy
              .newSchema(typeClass);
        }
      }
    }
  }
  return schema;
}
origin: protostuff/protostuff

@Override
public <T extends Message<T>> byte[] serialize(T message)
{
  return JsonIOUtil.toByteArray(message, message.cachedSchema(), false);
}
origin: protostuff/protostuff

/**
 * Computes the serialized size of a message.
 */
public static <T extends Message<T>> int getSize(T message)
{
  return getSize(message, message.cachedSchema(), false);
}
origin: protostuff/protostuff

/**
 * Computes the buffer size and serializes the {@code message} into a byte array.
 */
public static <T extends Message<T>> byte[] toByteArray(T message)
{
  return toByteArray(message, message.cachedSchema(), false);
}
origin: protostuff/protostuff

@Override
public <T extends Message<T>> byte[] serialize(T message)
{
  return toByteArrayBufferedProtobuf(message, message.cachedSchema());
}
origin: protostuff/protostuff

/**
 * Serializes the {@code message} into a byte array.
 */
protected <T extends Message<T>> byte[] toByteArray(T message)
{
  return toByteArray(message, message.cachedSchema());
}
origin: protostuff/protostuff

/**
 * Serializes the {@code message} (delimited) into an {@link OutputStream} via {@link DeferredOutput} using the
 * given schema.
 */
protected abstract <T> void writeDelimitedTo(OutputStream out, T message, Schema<T> schema)
    throws IOException;
origin: protostuff/protostuff

/**
 * Serializes the {@code message} into a byte array.
 */
protected <T extends Message<T>> byte[] toByteArray(T message)
{
  return toByteArray(message, message.cachedSchema());
}
io.protostuffMessage

Javadoc

The serializable object where its Schema handles its serialization and deserialization.

Most used methods

  • cachedSchema

Popular in Java

  • Reading from database using SQL prepared statement
  • compareTo (BigDecimal)
  • notifyDataSetChanged (ArrayAdapter)
  • getSystemService (Context)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Top 12 Jupyter Notebook extensions
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