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

How to use
Output
in
io.protostuff

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

origin: protostuff/protostuff

@Override
public void writeTo(Output output, int number, String value,
    boolean repeated) throws IOException
{
  output.writeString(number, (CharSequence) value, repeated);
}
origin: protostuff/protostuff

@Override
protected void transfer(Pipe pipe, Input input, Output output,
    boolean repeated) throws IOException
{
  output.writeObject(number, pipe, schema.pipeSchema, repeated);
}
origin: protostuff/protostuff

  @Override
  public void writeTo(Output output, Object value) throws IOException
  {
    ByteString[] array = (ByteString[]) value;
    output.writeInt32(ID_ARRAY_LEN, array.length, false);
    int nullCount = 0;
    for (int i = 0, len = array.length; i < len; i++)
    {
      ByteString v = array[i];
      if (v != null)
      {
        if (nullCount != 0)
        {
          output.writeUInt32(ID_ARRAY_NULLCOUNT, nullCount, false);
          nullCount = 0;
        }
        output.writeBytes(ID_ARRAY_DATA, v, true);
      }
      else if (allowNullArrayElement)
      {
        nullCount++;
      }
    }
    // if last element is null
    if (nullCount != 0)
      output.writeUInt32(ID_ARRAY_NULLCOUNT, nullCount, false);
  }
}
origin: protostuff/protostuff

@Override
public void writeTo(Output output, Bar message) throws IOException
{
  if (message.someInt != 0)
    output.writeInt32(1, message.someInt, false);
  if (message.someString != null)
    output.writeString(2, message.someString, false);
  if (message.someBaz != null)
    output.writeObject(3, message.someBaz, Baz.getSchema(), false);
  if (message.someEnum != null)
    output.writeEnum(4, message.someEnum.number, false);
  if (message.someBytes != null)
    output.writeBytes(5, message.someBytes, false);
  if (message.someBoolean)
    output.writeBool(6, message.someBoolean, false);
  if (message.someFloat != 0f)
    output.writeFloat(7, message.someFloat, false);
  if (message.someDouble != 0d)
    output.writeDouble(8, message.someDouble, false);
  if (message.someLong != 0l)
    output.writeInt64(9, message.someLong, false);
}
origin: protostuff/protostuff

@Override
public void writeTo(Output output, PojoWithInts message) throws IOException
{
  if (message.someInt32 != 0)
    output.writeInt32(1, message.someInt32, false);
  if (message.someUint32 != 0)
    output.writeUInt32(2, message.someUint32, false);
  if (message.someSint32 != 0)
    output.writeSInt32(3, message.someSint32, false);
  if (message.someFixed32 != 0)
    output.writeFixed32(4, message.someFixed32, false);
  if (message.someSfixed32 != 0)
    output.writeSFixed32(5, message.someSfixed32, false);
  if (message.someInt64 != 0)
    output.writeInt64(11, message.someInt64, false);
  if (message.someUint64 != 0)
    output.writeUInt64(12, message.someUint64, false);
  if (message.someSint64 != 0)
    output.writeSInt64(13, message.someSint64, false);
  if (message.someFixed64 != 0)
    output.writeFixed64(14, message.someFixed64, false);
  if (message.someSfixed64 != 0)
    output.writeSFixed64(15, message.someSfixed64, false);
}
origin: protostuff/protostuff

@Override
public void writeTo(Output output, Baz message) throws IOException
{
  if (message.id != 0)
    output.writeInt32(1, message.id, false);
  if (message.name != null)
    output.writeString(2, message.name, false);
  if (message.timestamp != 0l)
    output.writeInt64(3, message.timestamp, false);
}
origin: dremio/dremio-oss

public void writeTo(Output output, SplitRule message) throws IOException
{
  if(message.pattern == null)
    throw new UninitializedMessageException(message);
  output.writeString(1, message.pattern, false);
  if(message.matchType == null)
    throw new UninitializedMessageException(message);
  output.writeEnum(2, message.matchType.number, false);
  if(message.ignoreCase == null)
    throw new UninitializedMessageException(message);
  output.writeBool(3, message.ignoreCase, false);
}
origin: protostuff/protostuff

@Override
public void writeTo(Output output, ClubFounder message) throws IOException
{
  if (message.name != null)
    output.writeString(1, message.name, false);
  if (message.club != null)
    output.writeObject(2, message.club, Club.getSchema(), false);
}
origin: protostuff/protostuff

@Override
public void writeTo(Output output, PojoWithBiggerByteArray message) throws IOException
{
  output.writeInt32(1, message.id, false);
  output.writeByteArray(2, message.b, false);
  output.writeInt64(3, message.ts, false);
}
origin: protostuff/protostuff

@Override
public void transferByteRangeTo(Output output, boolean utf8String, int fieldNumber,
    boolean repeated) throws IOException
{
  if (utf8String)
    output.writeString(fieldNumber, readString(), repeated);
  else
    output.writeByteArray(fieldNumber, readByteArray(), repeated);
}
origin: protostuff/protostuff

/**
 * Writes the {@link Enum} to the output.
 */
public void writeTo(Output output, int number, boolean repeated,
    Enum<?> e) throws IOException
{
  if (0 == (IdStrategy.ENUMS_BY_NAME & strategy.flags))
    output.writeEnum(number, getTag(e), repeated);
  else
    output.writeString(number, getAlias(e), repeated);
}
origin: protostuff/protostuff

protected void writeLengthTo(Output output, int len, boolean primitive)
    throws IOException
{
  output.writeInt32(ID_ARRAY_LEN, len, false);
}

origin: fengjiachun/Jupiter

@Override
public void transferByteRangeTo(Output output, boolean utf8String, int fieldNumber,
                boolean repeated) throws IOException {
  final int length = readRawVarInt32();
  if (length < 0) {
    throw ProtocolException.negativeSize();
  }
  if (utf8String) {
    // if it is a UTF string, we have to call the writeByteRange.
    if (nioBuffer.hasArray()) {
      output.writeByteRange(true, fieldNumber, nioBuffer.array(),
          nioBuffer.arrayOffset() + nioBuffer.position(), length, repeated);
      nioBuffer.position(nioBuffer.position() + length);
    } else {
      byte[] bytes = new byte[length];
      nioBuffer.get(bytes);
      output.writeByteRange(true, fieldNumber, bytes, 0, bytes.length, repeated);
    }
  } else {
    // Do the potentially vastly more efficient potential splice call.
    if (nioBuffer.remaining() < length) {
      throw ProtocolException.misreportedSize();
    }
    ByteBuffer dup = nioBuffer.slice();
    dup.limit(length);
    output.writeBytes(fieldNumber, dup, repeated);
    nioBuffer.position(nioBuffer.position() + length);
  }
}
origin: protostuff/protostuff

@Override
public void writeInt64(int fieldNumber, long value, boolean repeated) throws IOException
{
  output.writeInt64(fieldNumber, value, repeated);
}
origin: protostuff/protostuff

@Override
public void writeBool(int fieldNumber, boolean value, boolean repeated) throws IOException
{
  output.writeBool(fieldNumber, value, repeated);
}
origin: protostuff/protostuff

@Override
public void writeDouble(int fieldNumber, double value, boolean repeated) throws IOException
{
  output.writeDouble(fieldNumber, value, repeated);
}
origin: protostuff/protostuff

/**
 * Writes the bytes to the {@link Output}.
 */
public static void writeTo(Output output, ByteString bs, int fieldNumber,
    boolean repeated) throws IOException
{
  output.writeByteArray(fieldNumber, bs.bytes, repeated);
}
origin: protostuff/protostuff

  output.writeBool(ID_ARRAY_DATA, array[i], true);
    output.writeUInt32(ID_ARRAY_NULLCOUNT, nullCount, false);
    nullCount = 0;
  output.writeBool(ID_ARRAY_DATA, v, true);
output.writeUInt32(ID_ARRAY_NULLCOUNT, nullCount, false);
origin: protostuff/protostuff

@Override
public void writeTo(Output output, int number, Character value,
    boolean repeated) throws IOException
{
  output.writeUInt32(number, value.charValue(), repeated);
}
origin: protostuff/protostuff

  output.writeDouble(ID_ARRAY_DATA, array[i], true);
    output.writeUInt32(ID_ARRAY_NULLCOUNT, nullCount, false);
    nullCount = 0;
  output.writeDouble(ID_ARRAY_DATA, v, true);
output.writeUInt32(ID_ARRAY_NULLCOUNT, nullCount, false);
io.protostuffOutput

Javadoc

An Output lets an application write primitive data types and objects to a sink of data.

Most used methods

  • writeString
  • writeObject
  • writeBytes
  • writeInt32
  • writeInt64
  • writeBool
  • writeDouble
  • writeByteArray
  • writeEnum
    Writes a enum(its number) field.
  • writeUInt32
  • writeFloat
  • writeUInt64
  • writeFloat,
  • writeUInt64,
  • writeFixed64,
  • writeByteRange,
  • writeSFixed64,
  • writeFixed32,
  • writeSFixed32,
  • writeSInt32,
  • writeSInt64

Popular in Java

  • Reading from database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setScale (BigDecimal)
  • getContentResolver (Context)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • 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
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Table (org.hibernate.mapping)
    A relational table
  • Top plugins for WebStorm
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