com.esotericsoftware.kryo.io.Output.writeString()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(193)

本文整理了Java中com.esotericsoftware.kryo.io.Output.writeString()方法的一些代码示例,展示了Output.writeString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Output.writeString()方法的具体详情如下:
包路径:com.esotericsoftware.kryo.io.Output
类名称:Output
方法名:writeString

Output.writeString介绍

[英]Writes the length and CharSequence as UTF8, or null. The string can be read using Input#readString() or Input#readStringBuilder().
[中]将长度和字符序列写入UTF8或null。可以使用Input#readString()或Input#readStringBuilder()读取字符串。

代码示例

代码示例来源:origin: apache/incubator-dubbo

@Override
public void writeUTF(String v) throws IOException {
  output.writeString(v);
}

代码示例来源:origin: apache/incubator-dubbo

@Override
public void writeUTF(String v) throws IOException {
  output.writeString(v);
}

代码示例来源:origin: apache/flink

@Override
public void write(Kryo kryo, Output output, Schema object) {
  String schemaAsString = object.toString(false);
  output.writeString(schemaAsString);
}

代码示例来源:origin: apache/hive

@Override
public void write(Kryo kryo, Output output, Path path) {
 output.writeString(path.toUri().toString());
}

代码示例来源:origin: apache/flink

@Override
public void write(Kryo kryo, Output output, PyString object) {
  output.writeString(object.asString());
}

代码示例来源:origin: apache/flink

@Override
public void write(Kryo kryo, Output output, WrappedString object) {
  output.writeString(object.content);
}

代码示例来源:origin: alibaba/jstorm

private void serializeStrings(List<Object> values, Output out) {
  out.writeInt(values.size(), true);
  for (Object o : values) {
    String str = (String) o;
    out.writeString(str);
  }
}

代码示例来源:origin: apache/storm

@Override
public void write(Kryo kryo, Output output, GenericContainer record) {
  String fingerPrint = this.getFingerprint(record.getSchema());
  output.writeString(fingerPrint);
  GenericDatumWriter<GenericContainer> writer = new GenericDatumWriter<>(record.getSchema());
  BinaryEncoder encoder = EncoderFactory
    .get()
    .directBinaryEncoder(output, null);
  try {
    writer.write(record, encoder);
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: alibaba/jstorm

@Override
  public void write(Kryo kryo, Output output, Pair inner) {
    output.writeLong(inner.getValue());
    output.writeString(inner.getKey());
  }
}

代码示例来源:origin: atomix/atomix

@Override
public void write(Kryo kryo, Output output, Address address) {
 output.writeString(address.host());
 output.writeInt(address.port());
}

代码示例来源:origin: orbit/orbit

private static void writeHeaders(Kryo kryo, Output out, Map<String, Object> headers)
{
  if (headers == null || headers.isEmpty())
  {
    out.writeInt(0);
    return;
  }
  out.writeInt(headers.size());
  for (Map.Entry<String, Object> entry : headers.entrySet())
  {
    out.writeString(entry.getKey());
    ValueType valueType = ValueType.getType(entry.getValue());
    out.writeByte(valueType.id);
    if (valueType.equals(ValueType.STRING))
    {
      out.writeString(String.valueOf(entry.getValue()));
    }
    else if (valueType.equals(ValueType.INT))
    {
      out.writeInt((Integer) entry.getValue());
    }
    else
    {
      kryo.writeClassAndObject(out, entry.getValue());
    }
  }
}

代码示例来源:origin: alibaba/jstorm

@Override
public void write(Kryo kryo, Output output, TradeCustomer inner) {
  kryo.writeObject(output, inner.getCustomer());
  kryo.writeObject(output, inner.getTrade());
  output.writeLong(inner.getTimestamp());
  output.writeString(inner.getBuffer());
}

代码示例来源:origin: apache/hive

@Override
public void write(Kryo kryo, Output output, TimestampTZ object) {
 output.writeLong(object.getEpochSecond());
 output.writeInt(object.getNanos());
 output.writeString(object.getZonedDateTime().getZone().getId());
}

代码示例来源:origin: orbit/orbit

private static void writeObjectId(Kryo kryo, Output out, Message message)
{
  ValueType valueTypeForObjectId = ValueType.getType(message.getObjectId());
  out.writeByte(valueTypeForObjectId.id);
  if (valueTypeForObjectId.equals(ValueType.STRING))
  {
    out.writeString(String.valueOf(message.getObjectId()));
  }
  else if (valueTypeForObjectId.equals(ValueType.INT))
  {
    out.writeInt((Integer) message.getObjectId());
  }
  else
  {
    kryo.writeClassAndObject(out, message.getObjectId());
  }
}

代码示例来源:origin: apache/tinkerpop

@Override
public void writeString(final String s) {
  unshadedOutput.writeString(s);
}

代码示例来源:origin: spring-projects/spring-integration

@Override
public void write(Kryo kryo, Output output, File file) {
  output.writeString(file.getPath());
}

代码示例来源:origin: magro/memcached-session-manager

@Override
public void write(Kryo kryo, Output output, User user) {
  output.writeString(user.getPassword());
  output.writeString(user.getUsername());
  
  final Collection<GrantedAuthority> authorities = user.getAuthorities();
  output.writeInt(authorities.size(), true);
  for (final GrantedAuthority item : authorities) {
    _kryo.writeClassAndObject(output, item);
  }
  output.writeBoolean(user.isAccountNonExpired());
  output.writeBoolean(user.isAccountNonLocked());
  output.writeBoolean(user.isCredentialsNonExpired());
  output.writeBoolean(user.isEnabled());
}

代码示例来源:origin: junkdog/artemis-odb

@Override
public void write (Kryo kryo, Output output, SaveFileFormat.ComponentIdentifiers ci) {
  int count = 0;
  for (Map.Entry<Integer, Class<? extends Component>> entry : ci.idToType.entrySet()) {
    count++;
  }
  output.writeShort(count);
  for (Map.Entry<Integer, Class<? extends Component>> entry : ci.idToType.entrySet()) {
    output.writeShort(entry.getKey().intValue());
    output.writeString(entry.getValue().getName());
  }
}

代码示例来源:origin: com.esotericsoftware/kryo

public void write (Kryo kryo, Output output, Locale l) {
  output.writeAscii(l.getLanguage());
  output.writeAscii(l.getCountry());
  output.writeString(l.getVariant());
}

代码示例来源:origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@SuppressWarnings("rawtypes")
@Override
public void write(Kryo kryo, Output output, Enum serverStatus) {
  super.write(kryo, output, serverStatus);
  if (serverStatus instanceof ServerStatus) {
    output.writeString(((ServerStatus) serverStatus).getRegistrationIdsValidationKey());
  }
}

相关文章