我正在尝试编写一个返回文件输入流的函数.它看起来像这样:
public FileInputStream getFileInputStream() {
File file;
try {
file = new File("somepath");
} catch (Exception e) {
}
FileInputStream fInputStream = new FileInputStream(file);
return fInputStream;
}
Run Code Online (Sandbox Code Playgroud)
所以这是我的问题 - 显然在异常情况下不会创建文件.但我需要一个文件对象来实例化FileInputStream.我有点迷失在这里,如何在仍然返回有效的FileInputStream对象时处理异常?
这应该很简单:我有以下代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var table = document.createElement("table");
table.setAttribute("id","table");
var headRow = document.createElement("tr");
var dataRow = document.createElement("tr");
var head = document.createElement("th");
var data = document.createElement("td");
head.innerHTML="head";
data.innerHTML="data";
headRow.appendChild(head);
dataRow.appendChild(data);
table.appendChild(headRow);
table.appendChild(dataRow);
console.log(document.styleSheets);
table.className = "table";
document.getElementById("test").appendChild(table);
});
</script>
</head>
<body>
<div id="test"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
问题是:在加载边时,从不应用bootstrap.min中为类"table"指定的样式.我还需要做些什么吗?我在最新版本的Safari中测试它.
任何帮助?
干杯Twerp
所以这是我想要工作的mxml:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import argoseye.main.Golem;
import mx.collections.ArrayCollection;
import mx.rpc.AsyncResponder;
import mx.rpc.AsyncToken;
import mx.rpc.Responder;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.InvokeEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.remoting.RemoteObject;
protected function button1_clickHandler(event:MouseEvent):void
{
var ro:RemoteObject = new RemoteObject("destination");
ro.endpoint = "http://Jesus/blazeds/messagebroker/amf";
ro.addEventListener(InvokeEvent.INVOKE,onInvoke);
var token:AsyncToken = new AsyncToken();
token.addResponder(new AsyncResponder(onResult,onFault));
token = ro.getCells();
textfeld.text = textfeld.text + "Clickhandler called .... \n";
}
public function onResult(event:ResultEvent,token:Object):void {
textfeld.text = textfeld.text + "Resulthandler called .... \n";
var cellList:ArrayCollection = event.result as ArrayCollection; …Run Code Online (Sandbox Code Playgroud)