public static KeyFile parse ( byte [ ] serialized ) { try ( InputStream in = new ByteArrayInputStream ( serialized ) ; // Reader reader = new InputStreamReader ( in , UTF_8 ) ; // JsonReader jsonReader = GSON . newJsonReader ( reader ) ) { JsonObject jsonObj = new JsonParser ( ) . parse ( jsonReader ) . getAsJsonObject ( ) ; KeyFile result = GSON . fromJson ( jsonObj , GenericKeyFile . class ) ; result . jsonObj = jsonObj ; return result ; } catch ( IOException | JsonParseException e ) { throw new IllegalArgumentException ( "Unable to parse key file." , e ) ; } }
Parses a json keyfile .