file-io

Reccomend an indexed file format that can be updated via random access in Java

I need an indexed file format that can hold a few hundred large variable sized binary blobs. Blobs are around 1-5MB and the file could be as large as 1 GB. I need to be able to quickly find, read, add and remove blobs without recreating the the entire file. I have no need to compress the blobs, however if blobs were removed, I'd like ...

C#2.0 read and copy Xml file line by line?

Hello. I got an Xml file fileOri.xml and there are some lines like <SubItem name='somename' value='someVal'></SubItem> and I plan to copy these lines to another file fileDes.xml. Is there a rapidly & easily way? ...

jump on specific location in binary file.

I have a binary file which contains image.i have to jump on different locations in file to read the image file. So far i am using mark and reset methods but these are not helping me as i want. please somebody help me about that i,ll be really thankful.and i am using Input Stream to read the file. ...

Finding the optimum file size combination

Hello, This is a problem I would think there is an algorithm for already - but I do not know the right words to use with google it seems :). The problem: I would like to make a little program with which I would select a directory containing any files (but for my purpose media files, audio and video). After that I would like to enter in...

Using Scala to cut up a large CSV file

What's the best way to do file IO in Scala 2.8? All I want to do is cut a massive CSV file into lots of smaller ones with, say 1000 lines of data per file, and each file retaining the header. ...

Is there a way to optimize the way I generate a file and output it as .zip in a java servlet?

A user has a few Lookup selections on a JSP page. After he's selected what data he wants exported, the JSP calls my servlet which should do something like this: get request data generate SQL for the request data execute the SQL and write it to a XML file package the XML file to a ZIP file and return it as a response Now, the first tw...

Splitting a word from a read file.

I'm trying to read the contents of a text file into the attributes of a class. The file is structured in such a way that each line contains all the information needed for one object of the class. One line might look like: TYC 9537 00066 1 341.76920751 -88.32499920 8.762 9.294 mc1 hd 210531 0.385 8.80 P F5 5 6440 F5 V What...

Android: How to store data on internal memory?

It's perfectly described here how to do it, the only problem: He doesnt know the function openFileOutput(); private void saveSettingsFile() { String FILENAME = "settings"; String string = "hello world!"; FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE); //openFileOutput underlined red ...

Try-Catch Block For C++ File-IO Errors Not Working

I'm very new to the world of C++ error handling, but I was told here: http://stackoverflow.com/questions/3622030/checking-for-file-existence-in-c ...that the best way to checks for file existence was with a try-catch block. From my limited knowledge on the topic, this sounds like sound advice. I located this snippet of code: http://ww...

Positioning an ifstream in very large files

Hi, I have to process very large log files (hundreds of Gigabytes) and in order to speed things up I want to split that processing on all the cores I have available. Using seekg and tellg I'm able to estimate the block sizes in relatively small files and position each thread on the beginning of these blocks but when they grow big the in...

Is this Macro Abuse?

I was reverse engineering some code and came across this... /************************************************************************/ /* */ /* MACRO CHECK_FREAD */ /* ...

Convert URL to AbsolutePath

Is there any easy way to convert a URL that contains to two-byte characters into an absolute path? The reason I ask is I am trying to find resources like this: URL url=getClass().getResources("/getresources/test.txt"); String path=url.toString(); File f=new File(path); The program can't find the file. I know the path contain '%20' fo...

Do I need to define ">>" operator to Use cin With Int32's ?

I need to read exactly 32 bits from a file. I'm using ifstream in the STL. Can I just directly say: int32 my_int; std::ifstream my_stream; my_stream.open("my_file.txt",std::ifstream::in); if (my_stream && !my_stream.eof()) my_stream >> my_int; ...or do I need to somehow override the >> operator to work with int32? I don't see t...

In Scala, how to find an elemein in CSV by a pair of key values?

For example, from a following file: Name,Surname,E-mail John,Smith,[email protected] Nancy,Smith,[email protected] Jane,Doe,[email protected] John,Doe,[email protected] how do I get e-mail address of John Doe? I use the following code now, but can specify only one key field now: val src = Source.fromFile(file) val iter =...

How to wait for a file to be copied completely?

I have a thread which polls a folder for new files. The problem is that it sees a new file and starts working on it even before the file has been completely copied by another process. Because of this the poller gets file used by another process error. Is there a way to check the file is free to use or get notified? We can certainly use ...

A Problem while Retriving file from FTPS Server

Hi All, I am working in an application development. On that application i am performing files store, retrieve and delete operations. For identifying the files on server i am using an index(a hash map file) file. every time when i perform upload operation i update "index" file and upload "index" file on server along with other uploading ...

PHP to delete lines within text file beginning with 0 or a negative number

Hi there, Thank you for taking the time to read this and I will appreciate every single response no mater the quality of content. :) Using php, I'm trying to create a script which will delete several lines within a text file (.txt) if required, based upon whether the line starts with a 0 or a negative number. Each line within the file ...

select() doesn't wait

Hi, I've to read program log file and to do that I wanted to use select() and read() #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/select.h> #include <fcntl.h> #include <stdio.h> int main() { int fd = -1; fd_set fds; struct timeval tv; int rc; char buffer[4096]; char * log_path = "/...

In Scala 2.8, how to write (append) a line to a file? Should I use Java clesses or there are native Scala functions for this?

In Scala 2.8, how to write (append) a line to a file? Should I use Java clesses or there are native Scala functions for this? If you can also tell how to replace or remove a particular line from a text file - it'd be also interesting. ...

Opening a file in 'a+ 'mode

If a file is opened using the following command: FILE *f1=fopen("test.dat","a+"); The man page reads: a+ Open for reading and appending (writing at end of file). The file is created if it does not exist. The initial file position for reading is at the beginning of the file, but...