Class FileAdapter

java.lang.Object
com.google.gson.TypeAdapter
com.compomics.util.io.json.adapter.FileAdapter

public class FileAdapter
extends com.google.gson.TypeAdapter
This class is intended to avoid the default behavior of the GSON parser to append the current path to the absolute path of a file. It should always be registered in the GSON builder as this is not wanted behavior.
Author:
Kenneth Verheggen
  • Constructor Summary

    Constructors 
    Constructor Description
    FileAdapter()
    Empty default constructor.
  • Method Summary

    Modifier and Type Method Description
    File read​(com.google.gson.stream.JsonReader in)  
    void write​(com.google.gson.stream.JsonWriter writer, Object t)  

    Methods inherited from class com.google.gson.TypeAdapter

    fromJson, fromJson, fromJsonTree, nullSafe, toJson, toJson, toJsonTree

    Methods inherited from class java.lang.Object

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

    • FileAdapter

      public FileAdapter()
      Empty default constructor.
  • Method Details

    • read

      public File read​(com.google.gson.stream.JsonReader in) throws IOException
      Specified by:
      read in class com.google.gson.TypeAdapter
      Throws:
      IOException
    • write

      public void write​(com.google.gson.stream.JsonWriter writer, Object t) throws IOException
      Specified by:
      write in class com.google.gson.TypeAdapter
      Throws:
      IOException