示例#1
0
  @Override
  public void asserts() {
    assertTrue(dstFile.exists());
    assertEquals(dstFile.length(), image.length());
    dstFile.delete();

    assertTrue(dstFile2.exists());
    assertEquals(dstFile2.length(), image.length());
    dstFile2.delete();
  }
 public boolean loadFile(final com.badlogic.gdx.files.FileHandle fileHandle) {
   final int len = (int) fileHandle.length();
   if (len <= 0) throw new com.badlogic.gdx.utils.GdxRuntimeException("Incorrect file specified");
   java.nio.ByteBuffer buff = BufferUtils.newByteBuffer(len);
   buff.put(fileHandle.readBytes());
   buff.position(0);
   boolean result = loadFileFromMemory(buff, len);
   //		com.badlogic.gdx.utils.BufferUtils.disposeUnsafeByteBuffer(buff);
   return result;
 }
示例#3
0
  public EditorScene load(FileHandle fullPathFile) {
    try {
      if (fullPathFile.length() == 0)
        throw new EditorRuntimeException("Scene file does not contain any data");

      BufferedReader reader = new BufferedReader(new FileReader(fullPathFile.file()));
      EditorScene scene = gson.fromJson(reader, EditorScene.class);
      scene.path = fileAccessModule.relativizeToAssetsFolder(fullPathFile);
      reader.close();

      scene.onDeserialize();

      return scene;
    } catch (IOException e) {
      throw new IllegalStateException("There was an IO error during scene loading", e);
    }
  }