简体   繁体   English

如何使用Java在Windows上创建虚拟磁盘(字母,共享等)?

[英]How can I create a virtual disk (letter, share, etc.) on Windows using Java?

I'm looking at trying a project for class and as part of it I will need to create a "disk" to allow users to write some files (eg a RAM disk). 我正在尝试尝试一个用于上课的项目,作为该项目的一部分,我将需要创建一个“磁盘”以允许用户写入一些文件(例如RAM磁盘)。 I've used various languages, but I'm most familiar with Java (I could maybe use C# and get it done in time). 我使用过多种语言,但是我对Java最熟悉(也许可以使用C#并及时完成)。 I'm wondering what is out there that can do this. 我想知道有什么可以做到这一点。

I've looked at Commons VFS, JLAN and Alfresco and I might be able to use the latter two but I'm wondering if there are other options. 我看过Commons VFS,JLAN和Alfresco,我也许可以使用后两者,但是我想知道是否还有其他选择。 Right now I'm looking at Java 7 which I read has new I/O stuff that might help... Really the main thing I need to figure out at this point is a way to map a drive. 现在,我正在看的Java 7中有新的I / O内容,这些内容可能会有所帮助……实际上,我现在需要弄清的主要事情是映射驱动器的方法。 For example, AFAICT, Commons VFS would let me access files somewhere (like FTP), but how can I present this access as a drive letter or share this can be mapped? 例如,AFAICT,Commons VFS可以让我访问某个地方的文件(例如FTP),但是我该如何以驱动器号形式显示此访问权限或共享可以映射的访问权限?

Thanks 谢谢

Update: To be more clear, what I'm trying to do (generally) is create something like Dropbox. 更新:更清楚地说,我想做的(通常)是创建类似Dropbox的东西。 I want to have a drive letter/share in Windows but the back-end will be something other than a local disk (like another machine on the LAN which runs a server component). 我想在Windows中有一个驱动器号/共享,但后端将是本地磁盘以外的其他设备(例如LAN上运行服务器组件的另一台计算机)。 I need to at least code the back-end logic to transfer data, but am unsure how to "glue" it into Windows such that it appears to be a disk or network share... It seems that using some sort of CIFS service and exposing that to the OS might make the most sense. 我至少需要对后端逻辑进行编码以传输数据,但是不确定如何将其“粘合”到Windows中,使其看起来像是磁盘或网络共享...似乎使用某种CIFS服务和将其暴露给操作系统可能是最有意义的。

You can use our Callback File System product to create a virtual filesystem and expose it via drive letter or folder on NTFS disk. 您可以使用我们的回调文件系统产品来创建虚拟文件系统,并通过驱动器号或NTFS磁盘上的文件夹公开它。 Filesystem operations will be handled by your code and you will be able to transfer the data to the cloud. 文件系统操作将由您的代码处理,您将能够将数据传输到云中。 This is the scenario used by dozens of our clients. 这是我们许多客户使用的方案。

In pure Java you will not be able to create a client side application but will have to create a server application that speaks something Windows already knows how to mount ( CIFS or Web DAV for example). 在纯Java中,您将无法创建客户端应用程序,但必须创建一个服务器应用程序,该服务器应用程序会说Windows已经知道如何安装的内容(例如CIFSWeb DAV )。 WebDAV would likely be the simplest to work with. WebDAV可能是最简单的处理方法。

Now you mention Dropbox in your post. 现在,您在帖子中提到了Dropbox。 Dropbox I don't believe actually creates a virtual drive or folder but rather replicates content to a local folder and the monitors said folder for changes. 我不相信Dropbox实际上会创建虚拟驱动器或文件夹,而是将内容复制到本地文件夹,并监视该文件夹中的更改。 If you select that route then Java has a WatchService to handle it (complete with tutorial ). 如果选择了该路由,那么Java将有一个WatchService来处理它(完整的tutorial )。 You would have to write both client and server side component but your files will be available while you are offline. 您将必须同时编写客户端和服务器端组件,但是您的文件将在脱机时可用。

You can try Microsoft's own RAM disk driver, if it still works on current Windows versions: http://support.microsoft.com/kb/257405 如果仍可以在当前Windows版本上运行,则可以尝试使用Microsoft自己的RAM磁盘驱动程序: http : //support.microsoft.com/kb/257405

Or if you just need a drive letter, try the subst command. 或者,如果您只需要驱动器号,请尝试使用subst命令。

If you actually need to program a solution, the simplest way I can think of is creating a file where you emulate your own simple file system (record store) and provide some interface whereby the user can manage files. 如果您确实需要对解决方案进行编程,那么我想到的最简单的方法是在一个文件中模拟自己的简单文件系统(记录存储),并提供一些界面供用户管理文件。 Ie a virtual file system. 即虚拟文件系统。

I don't know if current Windows versions have an equivalent to OS X's disk images, which would simplify things for you. 我不知道当前的Windows版本是否等效于OS X的磁盘映像,这将为您简化事情。

It's a little unclear what you're actually required to do. 尚不清楚您实际上需要做什么。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在MVC站点之间共享通用样式信息(css,图像等)? - How can I share common style information (css, images, etc.) across MVC sites? 我可以以编程方式在内存中创建虚拟磁盘吗? - Can I create a virtual disk in memory programatically? .NET如何创建和执行其Windows,按钮等? - How does .NET create and execute its Windows, buttons, etc.? 如何使用 Regex.IsMatch 查找是否有任何带口音的字母(é、á、à 等) - How can use Regex.IsMatch to find if there are any letter with accents(é, á, à, etc.) 如何/我们可以隐藏共享目标应用程序(例如OneNote,Twitter等),这些应用程序是在win 8 / winrt应用程序中使用c#从魅力栏中分享共享后显示的吗? - How to/Can we hide share target apps(e.g OneNote, Twitter, etc.) that are displayed after tapping share from charms bar using c# in win 8/winrt apps? 如何对SQLite查询进行排序而忽略文章(“the”,“a”等)? - How can I sort an SQLite query ignoring articles (“the”, “a”, etc.)? 如何使用C#实体框架获取SQL Server表/视图等中每一列的数据类型? - How can I get data type of each column in a SQL Server table/view etc. using C# Entity Framework? 使用Windows 7密码自动访问Truecrypt / Keepass等 - Automatically accessing Truecrypt/Keepass etc. using Windows 7 password 我如何快速学习C#(呃),已经知道C,Java,C ++等? - How do I learn C# fast(er), already knowing C, Java, C++, etc.? API 返回包含换行符等的 json。我该如何清理我的 json? - API returns json containing linebreaks etc. how can i clean my json?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM