Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.ide.common.blame;
import static com.android.SdkConstants.DOT_JSON;
import com.android.annotations.NonNull;
import com.google.common.base.Charsets;
import com.google.common.collect.Maps;
import com.google.common.io.Files;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Map;
/**
* Utility functions to save and load individual merge log files.
*
* They are sharded by the directory containing the file, giving a file layout of the form:
*
* .
* ├── multi
* │ └── values.json
* └── single
* ├── drawable.json
* ├── layout.json
* └── layout-land.json
*
* This allows incremental changes to only have to load and rewrite a small fraction of the
* total log data.
*/
public class MergingLogPersistUtil {
private static final SourceFileJsonTypeAdapter mSourceFileJsonTypeAdapter
= new SourceFileJsonTypeAdapter();
private static final SourcePositionJsonTypeAdapter mSourcePositionJsonTypeAdapter
= new SourcePositionJsonTypeAdapter();
private static final SourceFilePositionJsonSerializer mSourceFilePositionJsonTypeAdapter
= new SourceFilePositionJsonSerializer();
private static final String KEY_OUTPUT_FILE = "outputFile";
private static final String KEY_FROM = "from";
private static final String KEY_TO = "to";
private static final String KEY_MERGED = "merged";
private static final String KEY_SOURCE = "source";
private static final String KEY_MAP = "map";
private static final String INDENT_STRING = " ";
private static File getMultiFile(File folder, String shard) {
return new File (new File(folder, "multi"), shard + DOT_JSON);
}
private static File getSingleFile(File folder, String shard) {
return new File (new File(folder, "single"), shard + DOT_JSON);
}
/**
* File format example for values files: (all paths are absolute)
*