public JsonFactory create() { return new CBORFactory(); } }
/** * Jackson doesn't have native support for timestamp. As per the RFC 7049 * (https://tools.ietf.org/html/rfc7049#section-2.4.1) we will need to * write a tag and write the epoch. */ @Override public StructuredJsonGenerator writeValue(Date date, TimestampFormat timestampFormat) { if (!(getGenerator() instanceof CBORGenerator)) { throw new IllegalStateException("SdkCborGenerator is not created with a CBORGenerator."); } CBORGenerator generator = (CBORGenerator) getGenerator(); try { generator.writeTag(CBOR_TAG_TIMESTAP); generator.writeNumber(date.getTime()); } catch (IOException e) { throw new JsonGenerationException(e); } return this; }
protected void _reportUnexpectedBreak() throws IOException { if (_parsingContext.inRoot()) { throw _constructError("Unexpected Break (0xFF) token in Root context"); } throw _constructError("Unexpected Break (0xFF) token in definite length (" +_parsingContext.getExpectedLength()+") " +(_parsingContext.inObject() ? "Object" : "Array" )); }
private final CBORGenerator _createCBORGenerator(IOContext ctxt, int stdFeat, int formatFeat, ObjectCodec codec, OutputStream out) throws IOException { // false -> we won't manage the stream unless explicitly directed to CBORGenerator gen = new CBORGenerator(ctxt, stdFeat, formatFeat, _objectCodec, out); if (CBORGenerator.Feature.WRITE_TYPE_HEADER.enabledIn(formatFeat)) { gen.writeTag(CBORConstants.TAG_ID_SELF_DESCRIBE); } return gen; }
public JsonFactory create() { return new CBORFactory(); } }
protected void _reportUnexpectedBreak() throws IOException { if (_parsingContext.inRoot()) { throw _constructError("Unexpected Break (0xFF) token in Root context"); } throw _constructError("Unexpected Break (0xFF) token in definite length (" +_parsingContext.getExpectedLength()+") " +(_parsingContext.inObject() ? "Object" : "Array" )); }
private final CBORGenerator _createCBORGenerator(IOContext ctxt, int stdFeat, int formatFeat, ObjectCodec codec, OutputStream out) throws IOException { // false -> we won't manage the stream unless explicitly directed to CBORGenerator gen = new CBORGenerator(ctxt, stdFeat, formatFeat, _objectCodec, out); if (CBORGenerator.Feature.WRITE_TYPE_HEADER.enabledIn(formatFeat)) { gen.writeTag(CBORConstants.TAG_ID_SELF_DESCRIBE); } return gen; }
/** * Jackson doesn't have native support for timestamp. As per the RFC 7049 * (https://tools.ietf.org/html/rfc7049#section-2.4.1) we will need to * write a tag and write the epoch. */ @Override public StructuredJsonGenerator writeValue(Date date, TimestampFormat timestampFormat) { if (!(getGenerator() instanceof CBORGenerator)) { throw new IllegalStateException("SdkCborGenerator is not created with a CBORGenerator."); } CBORGenerator generator = (CBORGenerator) getGenerator(); try { generator.writeTag(CBOR_TAG_TIMESTAP); generator.writeNumber(date.getTime()); } catch (IOException e) { throw new JsonGenerationException(e); } return this; }
public CborJacksonCodec() { super(new ObjectMapper(new CBORFactory())); }
protected void _reportUnexpectedBreak() throws IOException { if (_parsingContext.inRoot()) { throw _constructError("Unexpected Break (0xFF) token in Root context"); } throw _constructError("Unexpected Break (0xFF) token in definite length (" +_parsingContext.getExpectedLength()+") " +(_parsingContext.inObject() ? "Object" : "Array" )); }
private final CBORGenerator _createCBORGenerator(IOContext ctxt, int stdFeat, int formatFeat, ObjectCodec codec, OutputStream out) throws IOException { // false -> we won't manage the stream unless explicitly directed to CBORGenerator gen = new CBORGenerator(ctxt, stdFeat, formatFeat, _objectCodec, out); if (CBORGenerator.Feature.WRITE_TYPE_HEADER.enabledIn(formatFeat)) { gen.writeTag(CBORConstants.TAG_ID_SELF_DESCRIBE); } return gen; }
public CborJacksonCodec() { super(new ObjectMapper(new CBORFactory())); }
public CborJacksonCodec(ClassLoader classLoader) { super(createObjectMapper(classLoader, new ObjectMapper(new CBORFactory()))); }
public CborJacksonCodec(ClassLoader classLoader) { super(createObjectMapper(classLoader, new ObjectMapper(new CBORFactory()))); }
RootBeanDefinition jacksonConverterDef = createConverterDefinition(type, source); GenericBeanDefinition jacksonFactoryDef = createObjectMapperFactoryDefinition(source); jacksonFactoryDef.getPropertyValues().add("factory", new CBORFactory()); jacksonConverterDef.getConstructorArgumentValues().addIndexedArgumentValue(0, jacksonFactoryDef); messageConverters.add(jacksonConverterDef);
RootBeanDefinition jacksonConverterDef = createConverterDefinition(type, source); GenericBeanDefinition jacksonFactoryDef = createObjectMapperFactoryDefinition(source); jacksonFactoryDef.getPropertyValues().add("factory", new CBORFactory()); jacksonConverterDef.getConstructorArgumentValues().addIndexedArgumentValue(0, jacksonFactoryDef); messageConverters.add(jacksonConverterDef);