当前位置: 首页>>代码示例>>Java>>正文


Java SerializationException类代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.SerializationException的典型用法代码示例。如果您正苦于以下问题:Java SerializationException类的具体用法?Java SerializationException怎么用?Java SerializationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SerializationException类属于com.badlogic.gdx.utils包,在下文中一共展示了SerializationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import com.badlogic.gdx.utils.SerializationException; //导入依赖的package包/类
/** Parses the given reader.
 * @param reader the reader
 * @throws SerializationException if the reader cannot be successfully parsed. */
public void parse (Reader reader) {
	try {
		char[] data = new char[1024];
		int offset = 0;
		while (true) {
			int length = reader.read(data, offset, data.length - offset);
			if (length == -1) break;
			if (length == 0) {
				char[] newData = new char[data.length * 2];
				System.arraycopy(data, 0, newData, 0, data.length);
				data = newData;
			} else
				offset += length;
		}
		parse(data, 0, offset);
	} catch (IOException ex) {
		throw new SerializationException(ex);
	} finally {
		StreamUtils.closeQuietly(reader);
	}
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:25,代码来源:BehaviorTreeReader.java

示例2: getOwnerCharacterName

import com.badlogic.gdx.utils.SerializationException; //导入依赖的package包/类
private String getOwnerCharacterName() {
	if (ownerCharacterName == null && s_ownerCharacterId != null) {
		try {
			GameObject go = GameState.getGameObjectById(s_ownerCharacterId);
			if (go instanceof GameCharacter) {
				ownerCharacterName =  ((GameCharacter) go).getName();
			} else {
				XmlReader xmlReader = new XmlReader();
				Element root = xmlReader.parse(Gdx.files
						.internal(Configuration.getFolderCharacters()
								+ s_ownerCharacterId + ".xml"));
				ownerCharacterName = root.getChildByName(
						XMLUtil.XML_PROPERTIES).get(
						XMLUtil.XML_ATTRIBUTE_NAME);
			}
		} catch (SerializationException e) {
			throw new GdxRuntimeException("Could not determine the owner with type "+s_ownerCharacterId, e);
		}
		if (ownerCharacterName == null) {
			throw new GdxRuntimeException("Could not determine the owner with type "+s_ownerCharacterId);
		}
	}
	return Strings.getString(ownerCharacterName);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:25,代码来源:ItemOwner.java

示例3: parseNonCLosing

import com.badlogic.gdx.utils.SerializationException; //导入依赖的package包/类
/**
 * Parses the supplied InputStream without closing it at the end using the
 * supplied XmlReader.
 * 
 * @param inStream
 * @return
 */
public static Element parseNonCLosing(XmlReader parser, InputStream inStream) {
	try {
		InputStreamReader inReader = new InputStreamReader(inStream, "UTF-8");
		char[] data = new char[1024];
		int offset = 0;
		while (true) {
			int length = inReader.read(data, offset, data.length - offset);
			if (length == -1)
				break;
			if (length == 0) {
				char[] newData = new char[data.length * 2];
				System.arraycopy(data, 0, newData, 0, data.length);
				data = newData;
			} else
				offset += length;
		}
		return parser.parse(data, 0, offset);
	} catch (IOException ex) {
		throw new SerializationException(ex);
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:29,代码来源:XMLUtil.java

示例4: handleHttpResponse

import com.badlogic.gdx.utils.SerializationException; //导入依赖的package包/类
@Override
public void handleHttpResponse(Net.HttpResponse httpResponse) {
    try {
        handleResponse(httpResponse.getResultAsString());
        if (statsReporterResponseListener != null) {
            statsReporterResponseListener.succeed(responseVO);
        }
    } catch (Error error) {
        Gdx.app.error(TAG, error.getMessage());
        if (statsReporterResponseListener != null) {
            statsReporterResponseListener.failed(error);
        }
    } catch (SerializationException e) {
        e.printStackTrace();
        if (statsReporterResponseListener != null) {
            statsReporterResponseListener.failed(e);
        }
    }
}
 
开发者ID:UnderwaterApps,项目名称:submarine,代码行数:20,代码来源:StatsReporter.java

示例5: loadSkin

import com.badlogic.gdx.utils.SerializationException; //导入依赖的package包/类
private Skin loadSkin(GdxFileSystem fileSystem) {
    String skinPath = "skin/uiskin.json";

    FileHandle skinFile = null;
    if (fileSystem.getFileExists(FilePath.of(skinPath))) {
        skinFile = fileSystem.resolve(skinPath);
    } else {
        // Fallback: use the internal skin stored in the classpath
        skinFile = Gdx.files.classpath("builtin/" + skinPath);
    }

    // Load skin
    if (skinFile != null) {
        try {
            return new Skin(skinFile);
        } catch (SerializationException se) {
            LOG.error("Error loading Scene2d skin", se);
        }
    }
    return new Skin();
}
 
开发者ID:anonl,项目名称:nvlist,代码行数:22,代码来源:Scene2dEnv.java

示例6: loadChapter

import com.badlogic.gdx.utils.SerializationException; //导入依赖的package包/类
public void loadChapter(String selChapter) throws IOException {
	undoStack.clear();

	setSelectedScene(null);

	try {
		chapter.load(selChapter);
		firePropertyChange(NOTIFY_CHAPTER_LOADED);
		Ctx.project.getEditorConfig().setProperty("project.selectedChapter", selChapter);
	} catch (SerializationException ex) {
		// check for not compiled custom actions
		if (ex.getCause() != null && ex.getCause() instanceof ClassNotFoundException) {
			EditorLogger.msg("Custom action class not found. Trying to compile...");
			if (RunProccess.runGradle(Ctx.project.getProjectDir(), "desktop:compileJava")) {
				((FolderClassLoader)ActionFactory.getActionClassLoader()).reload();
				chapter.load(selChapter);
			} else {
				throw new IOException("Failed to run Gradle.");
			}
		} else {
			throw ex;
		}
	}

	i18n.load(selChapter);
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:27,代码来源:Project.java

示例7: loadScene

import com.badlogic.gdx.utils.SerializationException; //导入依赖的package包/类
/**
 * Use this to load in an individual .json scene. Any previously loaded scene
 * data will be lost (including Box2D objects!)
 * 
 * @param _file
 *           File to read.
 * @return The scene represented by the RUBE JSON file.
 */
public RubeScene loadScene(FileHandle _file)
{
   if (mRubeWorldSerializer != null)
   {
      mRubeWorldSerializer.resetScene();
   }
   if (mWorld != null)
   {
      mRubeWorldSerializer.usePreexistingWorld(mWorld);
   }
   RubeScene scene = null;
   try
   {
      scene = json.fromJson(RubeScene.class, _file);
   }
   catch (SerializationException ex)
   {
      throw new SerializationException("Error reading file: " + _file, ex);
   }
   return scene;
}
 
开发者ID:tescott,项目名称:RubeLoader,代码行数:30,代码来源:RubeSceneLoader.java

示例8: addScene

import com.badlogic.gdx.utils.SerializationException; //导入依赖的package包/类
/**
 * This method accumulates objects defined in a scene, allowing several separate
 * RUBE .json files to be combined. Objects are added to the scene's data, as
 * well as within the Box2D world that is ultimately returned.
 * 
 * @param _file
 *           The JSON file to parse
 * @return The cumulative scene
 */
public RubeScene addScene(FileHandle _file)
{
   RubeScene scene = null;

   if ((mRubeWorldSerializer != null) && (mWorld != null))
   {
      mRubeWorldSerializer.usePreexistingWorld(mWorld);
   }
   try
   {
      scene = json.fromJson(RubeScene.class, _file);
   }
   catch (SerializationException ex)
   {
      throw new SerializationException("Error reading file: " + _file, ex);
   }
   return scene;
}
 
开发者ID:tescott,项目名称:RubeLoader,代码行数:28,代码来源:RubeSceneLoader.java

示例9: readNamedObjects

import com.badlogic.gdx.utils.SerializationException; //导入依赖的package包/类
private void readNamedObjects(Json paramJson, Class paramClass, ObjectMap<String, ObjectMap> paramObjectMap)
{
  if (paramClass == Skin.TintedDrawable.class);
  for (Object localObject1 = Drawable.class; ; localObject1 = paramClass)
  {
    Iterator localIterator = paramObjectMap.entries().iterator();
    while (true)
    {
      if (!localIterator.hasNext())
        return;
      ObjectMap.Entry localEntry = (ObjectMap.Entry)localIterator.next();
      String str = (String)localEntry.key;
      Object localObject2 = paramJson.readValue(paramClass, localEntry.value);
      if (localObject2 != null)
        try
        {
          this.this$0.add(str, localObject2, (Class)localObject1);
        }
        catch (Exception localException)
        {
          throw new SerializationException("Error reading " + paramClass.getSimpleName() + ": " + (String)localEntry.key, localException);
        }
    }
  }
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:26,代码来源:Skin$2.java

示例10: read

import com.badlogic.gdx.utils.SerializationException; //导入依赖的package包/类
public Skin read(Json paramJson, Object paramObject, Class paramClass)
{
  Iterator localIterator = ((ObjectMap)paramObject).entries().iterator();
  while (localIterator.hasNext())
  {
    ObjectMap.Entry localEntry = (ObjectMap.Entry)localIterator.next();
    String str = (String)localEntry.key;
    ObjectMap localObjectMap = (ObjectMap)localEntry.value;
    try
    {
      readNamedObjects(paramJson, Class.forName(str), localObjectMap);
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new SerializationException(localClassNotFoundException);
    }
  }
  return this.val$skin;
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:20,代码来源:Skin$2.java

示例11: write

import com.badlogic.gdx.utils.SerializationException; //导入依赖的package包/类
@Override
public final void write(Json json) {
    for (Entry<String, StoragePrimitive> entry : properties.entrySet()) {
        try {
            json.getWriter().json(entry.getKey(), entry.getValue().toJson());
        } catch (IOException e) {
            throw new SerializationException(e);
        }
    }
}
 
开发者ID:anonl,项目名称:nvlist,代码行数:11,代码来源:Storage.java

示例12: loadEntities

import com.badlogic.gdx.utils.SerializationException; //导入依赖的package包/类
private void loadEntities(){
	logger.debug("Loading Entities");
	
	Json json = new Json();
	for (String s : manifest.entities){
		try {
			EntityConfig config = json.fromJson(EntityConfig.class, Gdx.files.internal(s));
			entityConfigs.put(config.name,config);
		}
		catch (SerializationException ex){
			logger.error("Failed to load entity file: " + s);
			logger.error(ex.getMessage());
		}
	}
}
 
开发者ID:Deftwun,项目名称:ZombieCopter,代码行数:16,代码来源:Assets.java

示例13: loadWeapons

import com.badlogic.gdx.utils.SerializationException; //导入依赖的package包/类
private void loadWeapons(){
	logger.debug("Loading Weapons");
	Json json = new Json();;
	for (String s : manifest.weapons){
		try {
			WeaponConfig config = json.fromJson(WeaponConfig.class, Gdx.files.internal(s));
			weaponConfigs.put(config.name,config);
		}
		catch (SerializationException ex){
			logger.error("Failed to load weapons file: " + s);
			logger.error(ex.getMessage());
		}
	}
}
 
开发者ID:Deftwun,项目名称:ZombieCopter,代码行数:15,代码来源:Assets.java

示例14: load

import com.badlogic.gdx.utils.SerializationException; //导入依赖的package包/类
/** Adds all resources in the specified skin JSON file. */
public void load (FileHandle skinFile) {
	try {
		getJsonLoader(skinFile).fromJson(Skin.class, skinFile);
	} catch (SerializationException ex) {
		throw new SerializationException("Error reading file: " + skinFile, ex);
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:9,代码来源:Skin.java

示例15: init

import com.badlogic.gdx.utils.SerializationException; //导入依赖的package包/类
@Override
public void init () {
	FileHandle storage = fileAccess.getMetadataFolder();
	FileHandle storageFile = storage.child("donateReminder.json");

	Json json = new Json();
	json.setIgnoreUnknownFields(true);
	json.addClassTag("EditorRunCounter", EditorRunCounter.class);

	EditorRunCounter runCounter;
	try {
		if (storageFile.exists()) {
			runCounter = json.fromJson(EditorRunCounter.class, storageFile);
		} else
			runCounter = new EditorRunCounter();
	} catch (SerializationException ignored) {
		runCounter = new EditorRunCounter();
	}

	runCounter.counter++;

	if (runCounter.counter % 50 == 0) {
		VisTable table = new VisTable(true);

		table.add("If you like VisEditor please consider").spaceRight(3);
		table.add(new LinkLabel("donating.", DONATE_URL));
		LinkLabel hide = new LinkLabel("Hide");
		table.add(hide);
		menuBar.setUpdateInfoTableContent(table);

		hide.setListener(labelUrl -> menuBar.setUpdateInfoTableContent(null));
	}

	json.toJson(runCounter, storageFile);
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:36,代码来源:DonateReminderModule.java


注:本文中的com.badlogic.gdx.utils.SerializationException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。