如何在Java中的RAM中挂载驱动器 [英] How to mount a drive in RAM in Java

查看:105
本文介绍了如何在Java中的RAM中挂载驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对RAMDisk进行编码,但是我不知道如何在RAM中安装驱动器。我将用Java编写。但是没有人能指出我用字母和名称在RAM中制作磁盘的方法。

I'm trying to code a RAMDisk, but I don't know how to mount a drive in RAM. I'm going to be writing this in Java. But could anyone point me to the way of making the disk in RAM with a letter and name.

谢谢!

编辑:为澄清起见,我想使用虚拟文件(例如存储在RAM中)制作文件。 DataRam的 Ramdisk 是我想要做的一个很好的例子。它创建一个文件并挂载驱动器。该驱动器在RAM中,并写入文件。我该如何实现? (我想为我自己的项目创建一个具有扩展思路的RAMDisk)

For clarification, I want to make a file with virtual files like stored in RAM. DataRam's Ramdisk is a good example of what I want to do. It creates a file and mounts a drive. The drive is in RAM and it writes to the file. How can I achieve this? (I wanted to create a RAMDisk for my own project with extended ideas)

推荐答案

RAMDisk(以及任何其他虚拟设备)需要使用设备驱动程序。幸运的是,设备驱动程序不是用Java或C#编写的(尤其是Xamarin,它用于完全不允许虚拟磁盘的移动操作系统)。尽管可以将Java用于业务逻辑,但是项目的某些部分将需要用非托管语言编写,并且项目本身应包括设备驱动程序。不用说,每个操作系统的设备驱动程序都不同。

RAMDisk (as well as any other virtual device) requires a device driver to be used. 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). 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. 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.

我们有两种情况的产品(分别为CallbackDisk和Callback File System)。它们都具有创建虚拟磁盘的示例,但是只有Callback File System包含要使用的Java API。两种产品都适用于Windows。

We have products for both cases (CallbackDisk and Callback File System respectively). They both have samples for creating a virtual disk, but only Callback File System includes Java API to use. Both products are for Windows.

在Linux上,存在用于实现各种文件系统的FUSE;在OSX上,存在OSXFUSE,它是FUSE的端口。

On Linux there exists FUSE to implement various filesystems, on OSX there exists OSXFUSE, a port of FUSE.

这篇关于如何在Java中的RAM中挂载驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆