random-access

How to insert characters to a file using C#

I have a huge file, where I have to insert certain characters at a specific location. What is the easiest way to do that in C# without rewriting the whole file again. ...

.NET C# - Random access in text files - no easy way?

Hi all, I've got a text file that contains several 'records' inside of it. Each record contains a name and a collection of numbers as data. I'm trying to build a class that will read through the file, present only the names of all the records, and then allow the user to select which record data he/she wants. The first time I go thro...

Compression formats with good support for random access within archives?

This is similar to a previous question, but the answers there don't satisfy my needs and my question is slightly different: I currently use gzip compression for some very large files which contain sorted data. When the files are not compressed, binary search is a handy and efficient way to support seeking to a location in the sorted da...

Can and How do you use RandomAccessFile with a file contained on an FTP server?

This problem pertains to Java By using RandomAccessFile I intend to be able to also modify the file without blanking it. ...

Java access to big file

I am looking for an efficient way to create a file whose size is unknown but can range from mb's to gb's and fill its content randomly. I may write first 200 bytes than jump to the end and write last 200 bytes and move to the middle and write there. Is RandomAccessFile efficient for doing this or are there any alternatives better suited ...

Does RandomAccessFile.close() internally call FileChannel.force()?

I am using RandomAccessFile to perform some writes to a file as part of a transaction. Before I commit my transaction, I want to be absolutely sure that the data is written to disk. Calling force(boolean) on the RAF's FileChannel appears to provide this guarantee, but is it called implicitly when I close the file, or do I have to call ...

c# Fastest way to randomly index into an array

I have an array of double values "vals", I need to randomly index into this array and get a value. GenRandomNumber() returns a number between 0 and 1 but never 0 or 1. I am using Convert.ToInt32 to basically get everything to the left of my decimal place, but there must be a more efficient way of doing this? Here's my code: public doub...

Multi-part gzip file random access (in Java)

This may fall in the realm of "not really feasible" or "not really worth the effort" but here goes. I'm trying to randomly access records stored inside a multi-part gzip file. Specifically, the files I'm interested in are compressed Heretrix Arc files. (In case you aren't familiar with multi-part gzip files, the gzip spec allows multipl...

SQLite - ORDER BY RAND()

In MySQL I can use the RAND() function, is there any alternative in SQLite 3? ...

why we can't Serialize these objects ?

why we can't Serialize objects into Random Access file ? and on the other hand we can serialize objects into sequential access file ? ""C# does not provide a means to obtain an object’s size at runtime. This means that, if we serialize the class, we cannot guarantee a fixed-length record size "" (from the book that i read in). so we ca...

Do any Java libraries provide a random access Queue implementation?

I'm implementing a sliding window over a stream of events, in Java. So I want a data structure which allows me to do the following: add to the end of the data structure when new events occur; remove from the start of the data structure when old events are processed; get standard random access (size(), get(i)) to the elements of the dat...

boost::multi_index_container with random_access and ordered_unique

Hi, I have a problem getting boost::multi_index_container work with random-access and with orderd_unique at the same time. (I'm sorry for the lengthly question, but I think I should use an example..) Here an example: Suppose I want to produce N objects in a factory and for each object I have a demand to fulfill (this demand is known at...

Java 1.6 abstracted random access.

As a java guru, what would you suggest to abstract random access so that a code can be agnostic to whether the data its accessing is in memory or in a file on the harddrive? (The files in question could be several gigabytes in size. Having random access is the most important feature.) ...

Any seekable compression library?

I'm looking for a general compression library that supports random access during decompression. I want to compress wikipedia into a single compressed format and at the same time I want to decompress/extract individual articles from it. Of course, I can compress each articles individually, but this won't give much compression ratio. I've...

Random-access container that does not fit in memory?

I have an array of objects (say, images), which is too large to fit into memory (e.g. 40GB). But my code needs to be able to randomly access these objects at runtime. What is the best way to do this? From my code's point of view, it shouldn't matter, of course, if some of the data is on disk or temporarily stored in memory; it should ...

Why does RandomAccessFile use int as offset

I am writing some data access test implementation and I need random access to file content. Here's the code: RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rwd"); final byte b[] = IOUtils.toByteArray(source); randomAccessFile.write(b, (int) offset, size); where offset has type long. Why doesn't RandomAccessFile provi...

STL deque accessing by index is O(1)?

I've read that accessing elements by position index can be done in constant time in a STL deque. As far as I know, elements in a deque may be stored in several non-contiguous locations, eliminating safe access through pointer arithmetic. For example: abc->defghi->jkl->mnop The elements of the deque above consists of a single character....

How to store randomly accessed files (both on writing and reading) in Jackrabbit JCR implementation?

Is it possible to store randomly accessed files (both on writing and reading) in Jackrabbit JCR implementation, if documentation says that DataStore interface stores data immutable. ...

is there a such thing as a randomly accessible pseudo-random number generator? (preferably open-source)

first off, is there a such thing as a random access random number generator, where you could not only sequentially generate random numbers as we're all used to, assuming rand100() always generates a value from 0-100: for (int i=0;i<5;i++) print rand100() output: 14 75 36 22 67 but also randomly access any random value like: rand...

switch to randomly selected view in xcode

utilising xcode using the random function i want to switch to from a view to a randomly selected new view...can some one give me some direction. ...