com.badlogic.gdx.utils.JsonWriter.OutputType Java Examples
The following examples show how to use
com.badlogic.gdx.utils.JsonWriter.OutputType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlayDataAccessor.java From beatoraja with GNU General Public License v3.0 | 6 votes |
/** * リプレイデータを書き込む * * @param rd * リプレイデータ * @param model * 対象のBMS * @param lnmode * LNモード */ public void wrireReplayData(ReplayData rd, BMSModel model, int lnmode, int index) { File replaydir = new File(this.getReplayDataFolder()); if (!replaydir.exists()) { replaydir.mkdirs(); } Json json = new Json(); json.setOutputType(OutputType.json); try { String path = this.getReplayDataFilePath(model, lnmode, index) + ".brd"; OutputStreamWriter fw = new OutputStreamWriter( new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(path))), "UTF-8"); fw.write(json.prettyPrint(rd)); fw.flush(); fw.close(); } catch (IOException e) { e.printStackTrace(); } }
Example #2
Source File: PlayDataAccessor.java From beatoraja with GNU General Public License v3.0 | 6 votes |
/** * コースリプレイデータを書き込む * * @param rd * リプレイデータ * @param hash * 対象のBMSハッシュ群 * @param lnmode * LNモード */ public void wrireReplayData(ReplayData[] rd, String[] hash, boolean ln, int lnmode, int index, CourseData.CourseDataConstraint[] constraint) { Json json = new Json(); json.setOutputType(OutputType.json); try { String path = this.getReplayDataFilePath(hash, ln, lnmode, index, constraint) + ".brd"; OutputStreamWriter fw = new OutputStreamWriter( new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(path))), "UTF-8"); fw.write(json.prettyPrint(rd)); fw.flush(); fw.close(); Logger.getGlobal().info("コースリプレイを保存:" + path); } catch (IOException e) { e.printStackTrace(); } }
Example #3
Source File: GLTFExporter.java From gdx-gltf with Apache License 2.0 | 5 votes |
private void end(FileHandle file){ root.bufferViews = binManager.views; root.buffers = binManager.flushAllToFiles(file.nameWithoutExtension()); Json json = new Json(); json.setOutputType(OutputType.json); json.setUsePrototypes(true); file.writeString(json.prettyPrint(root), false); reset(); }
Example #4
Source File: Config.java From beatoraja with GNU General Public License v3.0 | 5 votes |
public static void write(Config config) { Json json = new Json(); json.setUsePrototypes(false); json.setOutputType(OutputType.json); try (FileWriter writer = new FileWriter(MainController.configpath.toFile())) { writer.write(json.prettyPrint(config)); writer.flush(); } catch (IOException e) { e.printStackTrace(); } }
Example #5
Source File: WorldSerialization.java From bladecoder-adventure-engine with Apache License 2.0 | 5 votes |
public void saveGameState(String filename, boolean screenshot) throws IOException { EngineLogger.debug("SAVING GAME STATE"); if (w.isDisposed()) return; Json json = new BladeJson(w, Mode.STATE); json.setOutputType(OutputType.javascript); json.setSortFields(true); String s = null; if (EngineLogger.debugMode()) s = json.prettyPrint(this); else s = json.toJson(this); Writer writer = EngineAssetManager.getInstance().getUserFile(filename).writer(false, "UTF-8"); try { writer.write(s); writer.flush(); } catch (IOException e) { throw new IOException("ERROR SAVING GAME", e); } finally { writer.close(); } // Save Screenshot if (screenshot) w.takeScreenshot(filename + ".png", SCREENSHOT_DEFAULT_WIDTH); }
Example #6
Source File: JsonData.java From skin-composer with MIT License | 4 votes |
ExportFormat(String name, JsonWriter.OutputType outputType) { this.name = name; this.outputType = outputType; }
Example #7
Source File: JsonData.java From skin-composer with MIT License | 4 votes |
public JsonWriter.OutputType getOutputType() { return outputType; }
Example #8
Source File: ModelTools.java From bladecoder-adventure-engine with Apache License 2.0 | 4 votes |
public static void extractInkTexts(String file, String lang) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8")); StringBuilder sb = new StringBuilder(); try { String line = br.readLine(); // Replace the BOM mark if (line != null) line = line.replace('\uFEFF', ' '); while (line != null) { sb.append(line); sb.append("\n"); line = br.readLine(); } } finally { br.close(); } JsonValue root = new JsonReader().parse(sb.toString()); // .tsv generation to help in translation StringBuilder tsvString = new StringBuilder(); // .md generation to have a better readable document of texts StringBuilder mdString = new StringBuilder(); OrderedPropertiesBuilder builder = new OrderedPropertiesBuilder(); builder.withSuppressDateInComment(true); OrderedProperties prop = builder.build(); extractInkTextsInternal(root, tsvString, mdString, prop); FileUtils.writeStringToFile(new File(file + ".tsv"), tsvString.toString()); FileUtils.writeStringToFile(new File(file + ".txt"), mdString.toString()); String json = root.toJson(OutputType.json); FileUtils.writeStringToFile(new File(file), json); try { String file2 = file.substring(0, file.length() - EngineAssetManager.INK_EXT.length()); if (lang == null || lang.isEmpty() || lang.equals("default")) file2 += "-ink.properties"; else file2 += "-ink" + "_" + lang + ".properties"; FileOutputStream os = new FileOutputStream(file2); Writer out = new OutputStreamWriter(os, I18N.ENCODING); prop.store(out, null); } catch (IOException e) { EditorLogger.error("ERROR WRITING BUNDLE: " + file + ".properties"); } }