Here you can find the source of loadMetadata(File file)
public static Map<String, Object> loadMetadata(File file) throws IOException
//package com.java2s; //License from project: Open Source License import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.io.*; import java.util.HashMap; import java.util.Map; public class Main { public static Map<String, Object> loadMetadata(File file) throws IOException { StringBuilder metadataBuilder = new StringBuilder(); BufferedReader reader = new BufferedReader(new FileReader(file)); String line;/*w w w . j a v a 2 s . c om*/ while ((line = reader.readLine()) != null) { metadataBuilder.append(line).append('\n'); } reader.close(); Gson gson = new Gson(); return gson.fromJson(metadataBuilder.toString(), new TypeToken<HashMap<String, Object>>() { }.getType()); } }