小编jam*_*ame的帖子

java系统找不到指定的文件

我用Java来复制文件,但它出现异常(系统找不到指定的文件).

代码是

public static void copyFile(String sourceFile, String destFile){
    try {       
        InputStream in = new FileInputStream(sourceFile);
        OutputStream os = new FileOutputStream(destFile);
        byte[] buffer = new byte[1024];
        int count;
        while ((count = in.read(buffer)) > 0) {
            os.write(buffer, 0, count);
        }
        in.close();
        os.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Run Code Online (Sandbox Code Playgroud)

测试代码

public static void main(String[] args) {
    String name = getFileName("D:/z/temp.txt");
    String target = "D:/tem.txt";
    copyFile(name, target);
}
Run Code Online (Sandbox Code Playgroud)

例外是 java.io.FileNotFoundException: temp.txt(the system can not find the file specified)

  1. 文件'temp.txt'存在.
  2. 路径没问题.

我猜这是权限问题.谁能想出答案谢谢!

java

3
推荐指数
1
解决办法
852
查看次数

jQuery提交功能无法正常工作

我对jQuery提交功能有一些疑问.

这是工作环境

jQuery:1.7.2,chrome(18.0.1025.168 m).

有两个问题.

第一名:

我的代码是这样的

HTML

<form id="test" action="..." method="post">
     <input type="text" />
     <input type="submit">
</form>
Run Code Online (Sandbox Code Playgroud)

jQuery的

$('#test').submit(function(){
      return false;
})
Run Code Online (Sandbox Code Playgroud)

问题是它在firefox和opera中工作得很好但是chrome.

2ST:

html:如上所述.

jQuery的:

$('#test').submit(function(){
      if(...)
         alert(something..);
      return false;
})
Run Code Online (Sandbox Code Playgroud)

它不适用于firefox,opera和chrome.它总是触发form.submit为什么.

我很困惑.谁能想出来谢谢!

jquery submit

2
推荐指数
1
解决办法
2万
查看次数

Flutter 如何将触摸事件通过一个平台视图传递到另一个平台视图

我有一个具有两个平台视图的应用程序,其中一个是涂鸦视图,另一个是网络视图,下面是我的代码

\n\n
Widget build(BuildContext context) {\n    return Scaffold(\n      appBar: AppBar(\n        title: Text('test'),\n      ),\n      body: BlocProvider<CourseDocBloc>(\n        create: (context) => CourseDocBloc(),\n        child: Container(\n          height: double.infinity,\n          child: Stack(\n            children: <Widget>[\n              Listener(\n                child: WebView(\n                  initialUrl: 'https://google.com',\n                  javascriptMode: JavascriptMode.unrestricted,\n                  onPageStarted: (url) {\n                    print('start load');\n                  },\n                  onPageFinished: (url) {\n                    print('load finished');\n                  },\n                ),\n               onPointerDown: (e) => {print('web down')},\n               onPointerUp: (e) => {print('web up')},\n              ),\n              UiKitView(\n                viewType: 'GLView',\n                hitTestBehavior: PlatformViewHitTestBehavior.transparent, \n                onPlatformViewCreated: (_) => created(),\n              )\n            ],\n          ),\n        ),\n      ),\n    );\n  }\n
Run Code Online (Sandbox Code Playgroud)\n\n

当我设置UiKitView hitTestBehavior: PlatformViewHitTestBehavior.transparent …

dart flutter

2
推荐指数
1
解决办法
5520
查看次数

标签 统计

dart ×1

flutter ×1

java ×1

jquery ×1

submit ×1