我正在尝试访问设备中的一些文件(具有“Windows CE”其中的应用程序)显示为便携式设备在 windows 7 中使用 java applet....
我的设备路径是这样的
"Computer\Attari's Device\myfile.txt"
Now i am trying to access file from it using the same address but it gives path error or file not found.
同样我用过
"\\.\Attari's Device\myfile.txt"
but it resulted in same error tell me how to access portable devices using java applet
当我导航到连接的设备并右键单击文件并查看它的属性时,它会将其位置显示为
Location: Computer\Attari's Device
另外,当我打开此文件时,它会自动放置在temp我的电脑的文件。
我也使用签名小程序,因此不存在文件访问被拒绝的问题
我也用过
File.listRoots()
but it also does not list attached portable devices
I have to write some file in portable device using java applet
我使用 JMTP 库找到了上述问题的解决方案
http://code.google.com/p/jmtp/
这是我的代码
package jmtp;
import be.derycke.pieter.com.COMException;
import be.derycke.pieter.com.Guid;
import java.io.*;
import java.math.BigInteger;
import jmtp.PortableDevice;
import jmtp.*;
public class Jmtp {
public static void main(String[] args) {
PortableDeviceManager manager = new PortableDeviceManager();
PortableDevice device = manager.getDevices()[0];
// Connect to my mp3-player
device.open();
System.out.println(device.getModel());
System.out.println("---------------");
// Iterate over deviceObjects
for (PortableDeviceObject object : device.getRootObjects()) {
// If the object is a storage object
if (object instanceof PortableDeviceStorageObject) {
PortableDeviceStorageObject storage = (PortableDeviceStorageObject) object;
for (PortableDeviceObject o2 : storage.getChildObjects()) {
//
// BigInteger bigInteger1 = new BigInteger("123456789");
// File file = new File("c:/JavaAppletSigningGuide.pdf");
// try {
// storage.addAudioObject(file, "jj", "jj", bigInteger1);
// } catch (Exception e) {
// //System.out.println("Exception e = " + e);
// }
//
System.out.println(o2.getOriginalFileName());
}
}
}
manager.getDevices()[0].close();
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)