random-access

Working with Direct Access Files in C++

痞子三分冷 提交于 2019-12-01 12:58:32
问题 I am extremely new to C++ (and programming in general really) and am working on a project that has me stumped (not hard to do ha). The project involves Direct Access Files. We are to create a file consisting of a series of parts records. Here are some of the specifications: Should contain a header record (24 bytes - filled) indicating the number of valid items. Each (24 byte-long) data record will contain a stock number (4 digits max), a description (8 characters max), a count (4 digits), and

How are PDF files able to be partially displayed while downloading?

你离开我真会死。 提交于 2019-11-30 23:28:31
According to the PDF 1.7 specification, Sec 3.4 ( http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf , page 90): The preceding sections describe the syntax of individual objects. This section describes how objects are organized in a PDF file for efficient random access and incremental update. A canonical PDF file initially consists of four elements (see Figure 3.2): A one-line header identifying the version of the PDF specification to which the file conforms A body containing the objects that make up the document contained in the file A cross-reference table

How are PDF files able to be partially displayed while downloading?

岁酱吖の 提交于 2019-11-30 17:54:58
问题 According to the PDF 1.7 specification, Sec 3.4 (http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf, page 90): The preceding sections describe the syntax of individual objects. This section describes how objects are organized in a PDF file for efficient random access and incremental update. A canonical PDF file initially consists of four elements (see Figure 3.2): A one-line header identifying the version of the PDF specification to which the file conforms A

Random access gzip stream

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 23:36:07
I'd like to be able to do random access into a gzipped file. I can afford to do some preprocessing on it (say, build some kind of index), provided that the result of the preprocessing is much smaller than the file itself. Any advice? My thoughts were: Hack on an existing gzip implementation and serialize its decompressor state every, say, 1 megabyte of compressed data. Then to do random access, deserialize the decompressor state and read from the megabyte boundary. This seems hard, especially since I'm working with Java and I couldn't find a pure-java gzip implementation :( Re-compress the

What is the best compression algorithm that allows random reads/writes in a file?

試著忘記壹切 提交于 2019-11-28 18:20:00
What is the best compression algorithm that allows random reads/writes in a file? I know that any adaptive compression algorithms would be out of the question. And I know huffman encoding would be out of the question. Does anyone have a better compression algorithm that would allow random reads/writes? I think you could use any compression algorithm if you write it in blocks, but ideally I would not like to have to decompress a whole block at a time. But if you have suggestions on an easy way to do this and how to know the block boundaries, please let me know. If this is part of your solution,

STL deque accessing by index is O(1)?

我与影子孤独终老i 提交于 2019-11-28 10:40:28
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. The set of characters in one group indicate it is allocated in contiguous memory (e.g. abc is in a single block of memory, defhi is located in another block of memory, etc.). Can anyone explain how accessing by position index can be done in constant time,

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

泪湿孤枕 提交于 2019-11-28 06:23:53
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 through the file, I only read header names, but I can keep track of the 'position' in the file where the header is. I need random access to the text file to seek to the beginning of each record after a user asks for it. I have to do it this way because the file is too large to

Java: reading strings from a random access file with buffered input

余生长醉 提交于 2019-11-27 20:53:21
问题 I've never had close experiences with Java IO API before and I'm really frustrated now. I find it hard to believe how strange and complex it is and how hard it could be to do a simple task. My task: I have 2 positions (starting byte, ending byte), pos1 and pos2 . I need to read lines between these two bytes (including the starting one, not including the ending one) and use them as UTF8 String objects. For example, in most script languages it would be a very simple 1-2-3-liner like that (in

File Streaming in Java

ぃ、小莉子 提交于 2019-11-27 14:19:11
问题 I'm currently developing 3D graphics application using JOGL (Java OpenGL binding). In brief, I have a huge landscape binary file. Due to its size, I have to stream terrain chunks in the run-time. Therefore, we explicitly see the random access concern. I have already finished the first (and dirty :)) implementation (perhaps it is multi-threaded), where I'm using a foolish approach... Here is the initialization of it: dataInputStream = new DataInputStream(new BufferedInputStream(fileInputStream

What is the best compression algorithm that allows random reads/writes in a file?

☆樱花仙子☆ 提交于 2019-11-27 11:15:13
问题 What is the best compression algorithm that allows random reads/writes in a file? I know that any adaptive compression algorithms would be out of the question. And I know huffman encoding would be out of the question. Does anyone have a better compression algorithm that would allow random reads/writes? I think you could use any compression algorithm if you write it in blocks, but ideally I would not like to have to decompress a whole block at a time. But if you have suggestions on an easy way