Package io.sentry

Class JsonSerializer

  • All Implemented Interfaces:
    ISerializer

    public final class JsonSerializer
    extends java.lang.Object
    implements ISerializer
    The serializer class that uses manual JSON parsing with the help of vendored GSON reader/writer classes.
    • Constructor Summary

      Constructors 
      Constructor Description
      JsonSerializer​(@NotNull SentryOptions options)
      All our custom deserializers need to be registered to be used with the deserializer instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> T deserialize​(@NotNull java.io.Reader reader, @NotNull java.lang.Class<T> clazz)  
      @Nullable SentryEnvelope deserializeEnvelope​(@NotNull java.io.InputStream inputStream)  
      void serialize​(@NotNull SentryEnvelope envelope, @NotNull java.io.OutputStream outputStream)
      Serializes an envelope to an OutputStream
      @NotNull java.lang.String serialize​(@NotNull java.util.Map<java.lang.String,​java.lang.Object> data)  
      <T> void serialize​(T entity, @NotNull java.io.Writer writer)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JsonSerializer

        public JsonSerializer​(@NotNull
                              @NotNull SentryOptions options)
        All our custom deserializers need to be registered to be used with the deserializer instance. *
    • Method Detail

      • deserialize

        @Nullable
        public <T> T deserialize​(@NotNull
                                 @NotNull java.io.Reader reader,
                                 @NotNull
                                 @NotNull java.lang.Class<T> clazz)
        Specified by:
        deserialize in interface ISerializer
      • serialize

        public <T> void serialize​(@NotNull
                                  T entity,
                                  @NotNull
                                  @NotNull java.io.Writer writer)
                           throws java.io.IOException
        Specified by:
        serialize in interface ISerializer
        Throws:
        java.io.IOException
      • serialize

        public void serialize​(@NotNull
                              @NotNull SentryEnvelope envelope,
                              @NotNull
                              @NotNull java.io.OutputStream outputStream)
                       throws java.lang.Exception
        Serializes an envelope to an OutputStream
        Specified by:
        serialize in interface ISerializer
        Parameters:
        envelope - the envelope
        outputStream - will not be closed automatically
        Throws:
        java.lang.Exception - an exception
      • serialize

        @NotNull
        public @NotNull java.lang.String serialize​(@NotNull
                                                   @NotNull java.util.Map<java.lang.String,​java.lang.Object> data)
                                            throws java.lang.Exception
        Specified by:
        serialize in interface ISerializer
        Throws:
        java.lang.Exception