English 中文(简体)
NIO Persistent Array: Java
原标题:NIO Persistent Array : Java

我的任务是在我的“先进”贾瓦课程中设立一个NIO Persistent Array。 这个问题不是? 这对我来说是一个新概念;到目前为止,我的理解是,这基本上是指,你不以在法典中典型阵列中动态地储存信息,而是以预先确定的区块中 by的形式储存阵列的信息。 我感到困惑的是,你是如何从你试图储存到tes的那份信息中获取的,然后,你如何通过 Java的NIO向档案书写这些 by子?

TL;DR - 某人能否用一种营养来解释 JavaNIO Persistent Array? 我应如何从实地着手构筑一座楼?

感谢您事先提出的评论意见。

EDIT:此处为转让说明,字句:

目标

熟悉Java s NIO API。

所需经费

Use Java s NIO to create a PersistentArray class. The class should support the following methods:

static void create(String fileName, int bufferSize) - creates an empty persistent array

静态删除(String fileName)

PersistentArray open(String fileName) - opens the file associated with the persistent array and prepares the persistent array for gets and puts.

void put(int bufferID, Buffer buffer) - Stores the buffer at the bufferID s location (note that the buffer size must be the same as the size used when creating the array).

Buffer get(int bufferID) - given the buffer ID, retrieve the buffer previously stored at the location associated with bufferID.

int getNextID() - return one beyond the maximum ID ever used for storing a buffer .

结 论 - 关闭与持久性阵列有关的档案

此外,还进行了一项JUSG测试,显示所有方法都按预期行事。

3. 审查你与教员的工作。

最佳回答

What:
There is no such thing like "NIO persistent array". The instructor wants you to get acquainted with the NIO API (since it s better and faster than old IO API).

现在,在分配方面,你需要执行符合教员具体规定的等级。 没有任何缺陷,只是将一个“手法”数据(如你的情况,一个阵列)用于使用Nio的档案。

这份书面材料可能有助于您:http://techmumbojumbo.wordpress.com/201103/17/file-io-old-io-or-nio- the-is-better/"rel=“nofollow”>。 文件I/O:旧的I/O或NIO。 哪些是更好的?

TL;DR: There is no special meaning to NIO persistence. Just create an array which is not in memory, but also persists its content using NIO.

How:
Now, it can be implemented in many ways, Peter s answer is pretty good where is has recommended to use a RandomAccessFile.

问题回答

我只能假设他/她谈论的是所绘制的记忆档案。 可以使用兰诺阿雷斯群岛制造一个马普特布韦,你可以随意像一个阵列。 你对拜特贝勒人的改变依然存在。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...