简体   繁体   English

如何在Java中的RAM中挂载驱动器

[英]How to mount a drive in RAM in Java

I'm trying to code a RAMDisk, but I don't know how to mount a drive in RAM. 我正在尝试编写RAMDisk,但是我不知道如何在RAM中安装驱动器。 I'm going to be writing this in Java. 我将用Java编写。 But could anyone point me to the way of making the disk in RAM with a letter and name. 但是谁能指出我用字母和名称在RAM中制作磁盘的方法。

Thanks! 谢谢!

EDIT: For clarification, I want to make a file with virtual files like stored in RAM. 编辑:为澄清起见,我想使用虚拟文件(例如存储在RAM中)制作文件。 DataRam's Ramdisk is a good example of what I want to do. DataRam的Ramdisk是我想要做的一个很好的例子。 It creates a file and mounts a drive. 它创建一个文件并挂载驱动器。 The drive is in RAM and it writes to the file. 该驱动器在RAM中,并写入文件。 How can I achieve this? 我该如何实现? (I wanted to create a RAMDisk for my own project with extended ideas) (我想为自己的项目创建一个具有扩展思路的RAMDisk)

RAMDisk (as well as any other virtual device) requires a device driver to be used. RAMDisk(以及任何其他虚拟设备)都需要使用设备驱动程序。 Luckily, device drivers are not written in Java or C# (especially Xamarin, which is for mobile OS that don't allow virtual disks at all). 幸运的是,设备驱动程序不是用Java或C#编写的(特别是Xamarin,它用于完全不允许虚拟磁盘的移动OS)。 While you can use Java for business logic, some part of your project would need to be written in unmanaged language, and the project itself should include a device driver. 尽管可以将Java用于业务逻辑,但是项目的某些部分将需要用非托管语言编写,并且项目本身应包括设备驱动程序。 No need to say, that device drivers are different for each operating system. 不用说,每个操作系统的设备驱动程序都不同。

Now, the virtual disks can be of several kinds - the one where you have an image formatted to certain filesystem and handle block-level requests, and the one where you handle filesystem requests and implement the file system on its own. 现在,虚拟磁盘可以有多种类型-一种是将映像格式化为某些文件系统并处理块级请求的磁盘,另一种是您处理文件系统请求并自行实现文件系统的磁盘。

We have products for both cases (CallbackDisk and Callback File System respectively). 我们提供两种情况的产品(分别为CallbackDisk和Callback File System)。 They both have samples for creating a virtual disk, but only Callback File System includes Java API to use. 它们都具有创建虚拟磁盘的示例,但是只有Callback File System包含要使用的Java API。 Both products are for Windows. 两种产品都适用于Windows。

On Linux there exists FUSE to implement various filesystems, on OSX there exists OSXFUSE, a port of FUSE. 在Linux上,存在用于实现各种文件系统的FUSE;在OSX上,存在OSXFUSE,它是FUSE的端口。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM