日期:2014-05-20  浏览次数:20935 次

本地资源getResourceAsStream的参数要如何传?
大家好!
开发工具:eclipse,在项目的res文件夹中有个a.mpg视频资源,getResourceAsStream的参数要如何传?
在Manager.createPlayer之前,执行InputStream is = getClass().getResourceAsStream("a.mpg");总是会出错,提示如下,请问是什么原因啊?资源使用方面是不是还要做哪些设置?
Java code
java.lang.IllegalArgumentException: Unmatched braces in the pattern.
    at java.text.MessageFormat.applyPattern(Unknown Source)
    at java.text.MessageFormat.<init>(Unknown Source)
    at java.text.MessageFormat.format(Unknown Source)
    at org.eclipse.jdt.internal.core.util.Messages.bind(Messages.java:361)
    at org.eclipse.jdt.internal.core.util.Messages.bind(Messages.java:327)
    at org.eclipse.jdt.internal.core.util.Disassembler.disassemble(Disassembler.java:600)
    at org.eclipse.jdt.internal.core.util.Disassembler.disassemble(Disassembler.java:462)
    at org.eclipse.jdt.internal.ui.javaeditor.ClassFileEditor$SourceAttachmentForm.updateCodeView(ClassFileEditor.java:400)
    at org.eclipse.jdt.internal.ui.javaeditor.ClassFileEditor$SourceAttachmentForm.createControl(ClassFileEditor.java:212)
    at org.eclipse.jdt.internal.ui.javaeditor.ClassFileEditor.verifyInput(ClassFileEditor.java:715)
    at org.eclipse.jdt.internal.ui.javaeditor.ClassFileEditor.createPartControl(ClassFileEditor.java:672)
    at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:609)
    at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:384)
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:552)
    at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:223)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2362)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2295)
    at org.eclipse.ui.internal.WorkbenchPage.access$9(WorkbenchPage.java:2287)
    at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:2273)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2268)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2249)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility$1.run(SourceLookupFacility.java:353)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility.openEditor(SourceLookupFacility.java:362)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility.openEditor(SourceLookupFacility.java:278)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility.display(SourceLookupFacility.java:209)
    at org.eclipse.debug.ui.DebugUITools.displaySource(DebugUITools.java:673)
    at org.eclipse.debug.internal.ui.views.launch.LaunchView$SourceDisplayJob.runInUIThread(LaunchView.java:209)
    at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:93)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3057)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2716)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
    at org.eclipse.core.launcher.Main.run(Main.java:973)
    at org.eclipse.core.launcher.Main.main(Main.java:948)