org.apache.avro.io.JsonDecoder.error()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(112)

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

JsonDecoder.error介绍

暂无

代码示例

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

@Override
public void skipBytes() throws IOException {
 advance(Symbol.BYTES);
 if (in.getCurrentToken() == JsonToken.VALUE_STRING) {
  in.nextToken();
 } else {
  throw error("bytes");
 }
}

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

@Override
public void readNull() throws IOException {
 advance(Symbol.NULL);
 if (in.getCurrentToken() == JsonToken.VALUE_NULL) {
  in.nextToken();
 } else {
  throw error("null");
 }
}

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

@Override
public boolean readBoolean() throws IOException {
 advance(Symbol.BOOLEAN);
 JsonToken t = in.getCurrentToken();
 if (t == JsonToken.VALUE_TRUE || t == JsonToken.VALUE_FALSE) {
  in.nextToken();
  return t == JsonToken.VALUE_TRUE;
 } else {
  throw error("boolean");
 }
}

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

@Override
public ByteBuffer readBytes(ByteBuffer old) throws IOException {
 advance(Symbol.BYTES);
 if (in.getCurrentToken() == JsonToken.VALUE_STRING) {
  byte[] result = readByteArray();
  in.nextToken();
  return ByteBuffer.wrap(result);
 } else {
  throw error("bytes");
 }
}

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

private void doSkipFixed(int length) throws IOException {
 if (in.getCurrentToken() == JsonToken.VALUE_STRING) {
  byte[] result = readByteArray();
  in.nextToken();
  if (result.length != length) {
   throw new AvroTypeException("Expected fixed length " + length
     + ", but got" + result.length);
  }
 } else {
  throw error("fixed");
 }
}

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

@Override
public long readArrayStart() throws IOException {
 advance(Symbol.ARRAY_START);
 if (in.getCurrentToken() == JsonToken.START_ARRAY) {
  in.nextToken();
  return doArrayNext();
 } else {
  throw error("array-start");
 }
}

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

@Override
public long readMapStart() throws IOException {
 advance(Symbol.MAP_START);
 if (in.getCurrentToken() == JsonToken.START_OBJECT) {
  in.nextToken();
  return doMapNext();
 } else {
  throw error("map-start");
 }
}

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

@Override
public long skipArray() throws IOException {
 advance(Symbol.ARRAY_START);
 if (in.getCurrentToken() == JsonToken.START_ARRAY) {
  in.skipChildren();
  in.nextToken();
  advance(Symbol.ARRAY_END);
 } else {
  throw error("array-start");
 }
 return 0;
}

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

@Override
public float readFloat() throws IOException {
 advance(Symbol.FLOAT);
 if (in.getCurrentToken().isNumeric()) {
  float result = in.getFloatValue();
  in.nextToken();
  return result;
 } else {
  throw error("float");
 }
}

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

@Override
public int readInt() throws IOException {
 advance(Symbol.INT);
 if (in.getCurrentToken().isNumeric()) {
  int result = in.getIntValue();
  in.nextToken();
  return result;
 } else {
  throw error("int");
 }
}

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

@Override
public long readLong() throws IOException {
 advance(Symbol.LONG);
 if (in.getCurrentToken().isNumeric()) {
  long result = in.getLongValue();
  in.nextToken();
  return result;
 } else {
  throw error("long");
 }
}

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

@Override
public double readDouble() throws IOException {
 advance(Symbol.DOUBLE);
 if (in.getCurrentToken().isNumeric()) {
  double result = in.getDoubleValue();
  in.nextToken();
  return result;
 } else {
  throw error("double");
 }
}

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

@Override
public long skipMap() throws IOException {
 advance(Symbol.MAP_START);
 if (in.getCurrentToken() == JsonToken.START_OBJECT) {
  in.skipChildren();
  in.nextToken();
  advance(Symbol.MAP_END);
 } else {
  throw error("map-start");
 }
 return 0;
}

代码示例来源:origin: org.apache.avro/avro

@Override
public void skipBytes() throws IOException {
 advance(Symbol.BYTES);
 if (in.getCurrentToken() == JsonToken.VALUE_STRING) {
  in.nextToken();
 } else {
  throw error("bytes");
 }
}

代码示例来源:origin: org.apache.avro/avro

private void doSkipFixed(int length) throws IOException {
 if (in.getCurrentToken() == JsonToken.VALUE_STRING) {
  byte[] result = readByteArray();
  in.nextToken();
  if (result.length != length) {
   throw new AvroTypeException("Expected fixed length " + length
     + ", but got" + result.length);
  }
 } else {
  throw error("fixed");
 }
}

代码示例来源:origin: org.apache.avro/avro

@Override
public long readArrayStart() throws IOException {
 advance(Symbol.ARRAY_START);
 if (in.getCurrentToken() == JsonToken.START_ARRAY) {
  in.nextToken();
  return doArrayNext();
 } else {
  throw error("array-start");
 }
}

代码示例来源:origin: org.apache.avro/avro

@Override
public int readInt() throws IOException {
 advance(Symbol.INT);
 if (in.getCurrentToken().isNumeric()) {
  int result = in.getIntValue();
  in.nextToken();
  return result;
 } else {
  throw error("int");
 }
}

代码示例来源:origin: org.apache.avro/avro

@Override
public double readDouble() throws IOException {
 advance(Symbol.DOUBLE);
 if (in.getCurrentToken().isNumeric()) {
  double result = in.getDoubleValue();
  in.nextToken();
  return result;
 } else {
  throw error("double");
 }
}

代码示例来源:origin: org.apache.avro/avro

@Override
public long skipMap() throws IOException {
 advance(Symbol.MAP_START);
 if (in.getCurrentToken() == JsonToken.START_OBJECT) {
  in.skipChildren();
  in.nextToken();
  advance(Symbol.MAP_END);
 } else {
  throw error("map-start");
 }
 return 0;
}

代码示例来源:origin: org.apache.avro/avro

@Override
public float readFloat() throws IOException {
 advance(Symbol.FLOAT);
 if (in.getCurrentToken().isNumeric()) {
  float result = in.getFloatValue();
  in.nextToken();
  return result;
 } else {
  throw error("float");
 }
}

相关文章