Windows 上的便携式设备路径

发布于 2024-08-25 15:59:46 字数 474 浏览 3 评论 0原文

我实际上有一个 Windows/Java 问题。我有一个插入设备,我想通过 Java 访问它。通常,您可以通过驱动器盘符访问 USB 记忆棒等...但此平板电脑在 Windows 中显示为“便携式设备”...这意味着路径类似于“计算机\Archos 5S”,并且有没有盘符。

我想通过 Java 访问该设备上的文件,但我无法找出它的正确路径。那里有一个类似的问题,但没有有效的答案。或者还有其他方法可以通过 Java 访问该设备吗?


实际上我还没有解决这个问题...我仍然无法通过java访问这样的设备。

目前我正在尝试用Java访问Windows ShellFolder。 像这样的 Shellfolder:“Shell:::{35786D3C-B075-49b9-88DD-029876E11C01}”

这对于 Java 来说可能吗? 最近我发现了 sun.awt 类“ShellFolder”...这是想要的功能吗?

感谢您的帮助 里平

I've actually got an Windows/Java Question. I've got a plugged-in device which I want to access via Java. Normally you can access an e.g. USB-Stick via the Drive letter... but this tablet is displayed by Windows as a "Portable Device"... which means, that the Path is something like "Computer\Archos 5S" and there is no Drive letter.

I want to access a file on this device via Java, but I am not able to figure out the correct path to it. There is a similar question out there, but without a productive answer. Or is there another way to access this device via Java?


Actually I've not solved this problem... I am still not able to access such a device via java.

At the moment I am trying to access a windows ShellFolder in Java.
A Shellfolder like: "Shell:::{35786D3C-B075-49b9-88DD-029876E11C01}"

Is this possible with Java?
Recently I uncovered the sun.awt class "ShellFolder"... is this the wanted feature?

thanks for your help
Ripei

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夜灵血窟げ 2024-09-01 15:59:46

使用 https://code.google.com/p/jmtp/< 上的 JMTP 库解决上述问题/a>

这是我的代码,

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();

    }
}

不要忘记添加 jmtp.dll 文件(随 jmtp 下载一起提供)作为本机库。有关详细信息,请参阅我对在 Netbeans 中包含本机库的回答。

The solution to above problem using JMTP library on https://code.google.com/p/jmtp/

Here is my code

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();

    }
}

Do not forget add jmtp.dll files (that comes up with jmtp download) as a native library. For more info, see my answer on Including Native Library in Netbeans.

涙—继续流 2024-09-01 15:59:46

与 *nix 系统一样,所有设备(包括驱动器)都具有作为公共根的一部分的路径,这通常对用户隐藏,因为他们使用作为这些基本路径别名的驱动器号,但您也可以通过以下方式使用完整设备路径:在路径前加上 "\\.\"

例如,在我的机器 D: 上,翻译为 "\Device\HarddiskVolume1" 并且可以通过传递 " 来访问\\.\HarddiskVolume1" 到 CreateFile。

因此,您设备的路径可能是“\\.\Archos 5s”

Like *nix systems, all devices (including drives) have paths that are part of a common root, this is normally hidden from users because they use the drive letters which are aliases to these fundamental paths, but you can also use full device paths by prefixing the path with "\\.\"

For instance, on my machine D: translates as "\Device\HarddiskVolume1" and can be accessed by passing "\\.\HarddiskVolume1" to CreateFile.

So the path to your device is probably "\\.\Archos 5s".

单身情人 2024-09-01 15:59:46

您始终可以下载并安装 Windows 移动开发工具 Powertoys (http://www.microsoft.com/download/en/details.aspx?id=10601),并使用命令行实用程序 cecopy 在设备之间进行复制,您可以使用该实用程序可以从任何编程语言运行。还有其他选项,但它主要针对 .Net

you can always download and install the Windows mobile developer Powertoys (http://www.microsoft.com/download/en/details.aspx?id=10601) and copy from and to the device using the command line utility cecopy, which you can run from any programming language. There are other options there too, but it's most targeted at .Net

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文