io.protostuff.Input.readByteArray()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(111)

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

Input.readByteArray介绍

[英]Reads a byte array field value.
[中]读取字节数组字段值。

代码示例

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

@Override
public byte[] readByteArray() throws IOException
{
  return input.readByteArray();
}

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

@Override
public byte[] readFrom(Input input) throws IOException
{
  return input.readByteArray();
}

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

@Override
public byte[] readFrom(Input input) throws IOException
{
  return input.readByteArray();
}

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

@Override
public byte[] readFrom(Input input) throws IOException
{
  return input.readByteArray();
}

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

@Override
public BigInteger readFrom(Input input) throws IOException
{
  return new BigInteger(input.readByteArray());
}

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

@Override
public BigInteger readFrom(Input input) throws IOException
{
  return new BigInteger(input.readByteArray());
}

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

@Override
public BigInteger readFrom(Input input) throws IOException
{
  return new BigInteger(input.readByteArray());
}

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

@Override
public short[] readFrom(Input input) throws IOException
{
  reads++;
  byte[] buffer = input.readByteArray();
  short[] s = new short[buffer.length / 2];
  for (int i = 0, offset = 0; i < s.length; i++)
  {
    s[i] = (short) ((buffer[offset++] & 0xFF) << 8 | (buffer[offset++] & 0xFF));
  }
  return s;
}

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

static HasBar readHasBar(Input input) throws IOException
{
  ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(
      input.readByteArray()));
  try
  {
    return (HasBar) ois.readObject();
  }
  catch (Exception e)
  {
    throw new RuntimeException(e);
  }
  finally
  {
    ois.close();
  }
}

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

@Override
public Object readFrom(Input input, Object owner) throws IOException
{
  if (ID_ARRAY_LEN != input.readFieldNumber(this))
    throw new ProtostuffException("Corrupt input.");
  final int len = input.readInt32();
  BigInteger[] array = new BigInteger[len];
  if (input instanceof GraphInput)
  {
    // update the actual reference.
    ((GraphInput) input).updateLast(array, owner);
  }
  for (int i = 0; i < len;)
  {
    switch (input.readFieldNumber(this))
    {
      case ID_ARRAY_DATA:
        array[i++] = new BigInteger(input.readByteArray());
        break;
      case ID_ARRAY_NULLCOUNT:
        i += input.readUInt32();
        break;
      default:
        throw new ProtostuffException("Corrupt input.");
    }
  }
  if (0 != input.readFieldNumber(this))
    throw new ProtostuffException("Corrupt input.");
  return array;
}

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

@Override
public Object readFrom(Input input, Object owner) throws IOException
{
  if (ID_ARRAY_LEN != input.readFieldNumber(this))
    throw new ProtostuffException("Corrupt input.");
  final int len = input.readInt32();
  BigInteger[] array = new BigInteger[len];
  if (input instanceof GraphInput)
  {
    // update the actual reference.
    ((GraphInput) input).updateLast(array, owner);
  }
  for (int i = 0; i < len;)
  {
    switch (input.readFieldNumber(this))
    {
      case ID_ARRAY_DATA:
        array[i++] = new BigInteger(input.readByteArray());
        break;
      case ID_ARRAY_NULLCOUNT:
        i += input.readUInt32();
        break;
      default:
        throw new ProtostuffException("Corrupt input.");
    }
  }
  if (0 != input.readFieldNumber(this))
    throw new ProtostuffException("Corrupt input.");
  return array;
}

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

@Override
public Object readFrom(Input input, Object owner) throws IOException
{
  if (ID_ARRAY_LEN != input.readFieldNumber(this))
    throw new ProtostuffException("Corrupt input.");
  final int len = input.readInt32();
  byte[][] array = new byte[len][];
  if (input instanceof GraphInput)
  {
    // update the actual reference.
    ((GraphInput) input).updateLast(array, owner);
  }
  for (int i = 0; i < len;)
  {
    switch (input.readFieldNumber(this))
    {
      case ID_ARRAY_DATA:
        array[i++] = input.readByteArray();
        break;
      case ID_ARRAY_NULLCOUNT:
        i += input.readUInt32();
        break;
      default:
        throw new ProtostuffException("Corrupt input.");
    }
  }
  if (0 != input.readFieldNumber(this))
    throw new ProtostuffException("Corrupt input.");
  return array;
}

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

@Override
public Object readFrom(Input input, Object owner) throws IOException
{
  if (ID_ARRAY_LEN != input.readFieldNumber(this))
    throw new ProtostuffException("Corrupt input.");
  final int len = input.readInt32();
  byte[][] array = new byte[len][];
  if (input instanceof GraphInput)
  {
    // update the actual reference.
    ((GraphInput) input).updateLast(array, owner);
  }
  for (int i = 0; i < len;)
  {
    switch (input.readFieldNumber(this))
    {
      case ID_ARRAY_DATA:
        array[i++] = input.readByteArray();
        break;
      case ID_ARRAY_NULLCOUNT:
        i += input.readUInt32();
        break;
      default:
        throw new ProtostuffException("Corrupt input.");
    }
  }
  if (0 != input.readFieldNumber(this))
    throw new ProtostuffException("Corrupt input.");
  return array;
}

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

@Override
public void mergeFrom(Input input, PojoWithBiggerByteArray message) throws IOException
{
  for (int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
  {
    switch (number)
    {
      case 0:
        return;
      case 1:
        message.id = input.readInt32();
        break;
      case 2:
        message.b = input.readByteArray();
        break;
      case 3:
        message.ts = input.readInt64();
        break;
      default:
        input.handleUnknownField(number, this);
    }
  }
}

代码示例来源:origin: apache/servicecomb-java-chassis

@Override
public Object readFrom(Input input) throws IOException {
 return JsonUtils.readValue(input.readByteArray(), Object.class);
}

代码示例来源:origin: org.apache.servicecomb/foundation-protobuf

@Override
public Object readFrom(Input input) throws IOException {
 return input.readByteArray();
}

代码示例来源:origin: org.apache.servicecomb/common-protobuf

@Override
public Object readFrom(Input input) throws IOException {
 return JsonUtils.readValue(input.readByteArray(), Object.class);
}

代码示例来源:origin: org.apache.servicecomb/foundation-protobuf

@Override
public void mergeFrom(Input input, Object message) throws IOException {
 setter.set(message, input.readByteArray());
}

代码示例来源:origin: dremio/dremio-oss

public void mergeFrom(io.protostuff.Input input, com.dremio.exec.proto.UserProtos.PreparedStatementHandle.Builder builder) throws java.io.IOException
{
  for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
  {
    switch(number)
    {
      case 0:
        return;
      case 1:
        builder.setServerInfo(com.google.protobuf.ByteString.copyFrom(input.readByteArray()));
        break;
      default:
        input.handleUnknownField(number, this);
    }
  }
}
public boolean isInitialized(com.dremio.exec.proto.UserProtos.PreparedStatementHandle.Builder builder)

代码示例来源:origin: org.apache.servicecomb/foundation-protobuf

@Override
public void mergeFrom(Input input, Object message) throws IOException {
 input.readFieldNumber(null);
 String typeUrl = input.readString();
 input.readFieldNumber(null);
 byte[] bytes = input.readByteArray();
 input.readFieldNumber(null);
 AnyEntry anyEntry = (AnyEntry) message;
 anyEntry.setTypeUrl(typeUrl);
 anyEntry.setValue(bytes);
}

相关文章