public <T> T deserialize(String fromSource, GenericType<T> toType, Class<? extends BeanView<?>>... withViews) { StringReader reader = new StringReader(fromSource); return deserialize(toType, createReader(reader), new Context(this, Arrays.asList(withViews))); }
/** * @see #deserializeInto(com.owlike.genson.stream.ObjectReader, Object, Context) */ public <T> T deserializeInto(String json, T object) { return deserializeInto(createReader(new StringReader(json)), object, new Context(this)); }
/** * @see #deserializeInto(com.owlike.genson.stream.ObjectReader, Object, Context) */ public <T> T deserializeInto(String json, T object) { return deserializeInto(createReader(new StringReader(json)), object, new Context(this)); }
/** * Serializes this object to its json form in a byte array. */ public byte[] serializeBytes(Object object) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectWriter objectWriter = createWriter(baos); if (object == null) serializeNull(objectWriter); else serialize(object, object.getClass(), objectWriter, new Context(this)); return baos.toByteArray(); }
/** * Serializes this object to its json form in a byte array. */ public byte[] serializeBytes(Object object) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectWriter objectWriter = createWriter(baos); if (object == null) serializeNull(objectWriter); else serialize(object, object.getClass(), objectWriter, new Context(this)); return baos.toByteArray(); }
/** * @see #deserializeInto(com.owlike.genson.stream.ObjectReader, Object, Context) */ public <T> T deserializeInto(byte[] jsonBytes, T object) { return deserializeInto(createReader(jsonBytes), object, new Context(this)); }
/** * @see #deserializeInto(com.owlike.genson.stream.ObjectReader, Object, Context) */ public <T> T deserializeInto(InputStream is, T object) { return deserializeInto(createReader(is), object, new Context(this)); }
/** * Deserializes the incoming json stream into an instance of T. * Genson did not create the instance of InputStream so it will not be closed. */ public <T> T deserialize(InputStream input, GenericType<T> toType) { return deserialize(toType, createReader(input), new Context(this)); }
public <T> T deserialize(String fromSource, Class<T> toType, Class<? extends BeanView<?>>... withViews) { StringReader reader = new StringReader(fromSource); return deserialize(GenericType.of(toType), createReader(reader), new Context(this, Arrays.asList(withViews))); }
/** * @see #deserializeInto(com.owlike.genson.stream.ObjectReader, Object, Context) */ public <T> T deserializeInto(byte[] jsonBytes, T object) { return deserializeInto(createReader(jsonBytes), object, new Context(this)); }
/** * Deserializes the incoming json stream into an instance of T. * Genson did not create the instance of Reader so it will not be closed */ public <T> T deserialize(Reader reader, GenericType<T> toType) { return deserialize(toType, createReader(reader), new Context(this)); }
/** * Deserializes the incoming json stream into an instance of T. * Genson did not create the instance of InputStream so it will not be closed. */ public <T> T deserialize(InputStream input, GenericType<T> toType) { return deserialize(toType, createReader(input), new Context(this)); }
/** * Deserializes the incoming json stream into an instance of T. * Genson did not create the instance of Reader so it will not be closed */ public <T> T deserialize(Reader reader, GenericType<T> toType) { return deserialize(toType, createReader(reader), new Context(this)); }
/** * Deserializes the incoming json byte array into an instance of T. */ public <T> T deserialize(byte[] input, GenericType<T> toType) { return deserialize(toType, createReader(input), new Context(this)); }
/** * @see #deserializeInto(com.owlike.genson.stream.ObjectReader, Object, Context) */ public <T> T deserializeInto(Reader reader, T object) { return deserializeInto(createReader(reader), object, new Context(this)); }
/** * Deserializes the incoming json byte array into an instance of T. */ public <T> T deserialize(byte[] input, GenericType<T> toType) { return deserialize(toType, createReader(input), new Context(this)); }
/** * Deserializes fromSource String into an instance of toClass. * * @param fromSource source from which to deserialize. * @param toClass type into which to deserialize. * @throws com.owlike.genson.JsonBindingException * @throws JsonStreamException */ public <T> T deserialize(String fromSource, Class<T> toClass) { return deserialize(GenericType.of(toClass), createReader(new StringReader(fromSource)), new Context(this)); }
/** * Serializes this object to the passed Writer, as Genson did not instantiate it, you are * responsible of calling close on it. */ public void serialize(Object object, Writer writer) { ObjectWriter objectWriter = createWriter(writer); if (object == null) serializeNull(objectWriter); else serialize(object, object.getClass(), objectWriter, new Context(this)); }
/** * Deserializes the incoming json stream into an instance of T. * Genson did not create the instance of Reader so it will not be closed */ public <T> T deserialize(Reader reader, Class<T> toType) { return deserialize(GenericType.of(toType), createReader(reader), new Context(this)); }