Java Code Examples for com.badlogic.gdx.files.FileHandle#writeBytes()
The following examples show how to use
com.badlogic.gdx.files.FileHandle#writeBytes() .
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: UserDataHelper.java From dice-heroes with GNU General Public License v3.0 | 6 votes |
private void loadKey() { if (key != null) return; FileHandle keyFile = Gdx.files.local("app.key"); if (!keyFile.exists()) { try { KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); keyGenerator.init(128); key = keyGenerator.generateKey().getEncoded(); keyFile.writeBytes(key, false); } catch (Exception e) { Logger.log("failed to load key", e); } } else { key = keyFile.readBytes(); } }
Example 2
Source File: Recorder.java From gdx-proto with Apache License 2.0 | 5 votes |
private void writeBytes() { FileHandle fh = Gdx.files.external(demoDir + "history.dat"); byte[] bytes = new byte[Snapshot.SNAPSHOT_SIZE * history.size]; int idx = 0; for (Snapshot snap : history) { idx = snap.serialize(bytes, idx); } System.out.println("finished write, bytes length: " + bytes.length + ", idx: " + idx); fh.writeBytes(bytes, false); }
Example 3
Source File: Recorder.java From gdx-proto with Apache License 2.0 | 5 votes |
private void writeJson() { Json json = new Json(); String data = json.toJson(history); FileHandle fh = Gdx.files.external(demoDir + "history.json.gz"); byte[] bytes = Compression.writeCompressedString(data); if (bytes == null) { Log.error("Could not write compressed playback (JSON)"); } else { int byteCount = bytes.length; fh.writeBytes(bytes, false); Log.debug("Wrote compressed playback: " + byteCount + " bytes"); } }
Example 4
Source File: MPQViewer.java From riiablo with Apache License 2.0 | 4 votes |
private void write(MPQFileHandle handle, FileHandle dst, boolean tmp) { dst.writeBytes(handle.readBytes(), false); if (tmp) dst.file().deleteOnExit(); }