I have a little utility that does a search of a number of files. I had to create it because both Google & Windows desktop searches were not finding the appropriate lines in files. The searching works fine (I am willing to improve on it) but one of the things I would like to add to my util is a batch find/replace.
So how would be the bes...
I'm writing some Java code that uses a FileReader to load data from a few input files. I'm using TDD pretty heavily, and I'd like to add some tests that ensure that I'm cleaning up properly by calling close() on the reader when I'm done with it. Unfortunately, I can't come up with a good way to test for this. Anyone have any insights?
E...
When I run a program using the read part of fstream, I get this return value:
-1073741819
the actual function is part of a corrupt for loop, which I will try to explain:
for(int i = 0; i < vrs_top_i * 3; i += 3)
{
int X1x = FileRead(file2, i + 1);
int X1y = FileRead(file2, i + 2);
char X1sym = FileRead(file2, i + 3);
viral_data.a...
Hello Folks,
I have a file in .gz format. The java class for reading this file is GZIPInputStream.
However, this class doesn't extend the BufferedReader class of java. As a result, I am not able to read the file line by line. I need something like this
reader = new MyGZInputStream( some constructor of GZInputStream)
reader.readLine...
I have some reference data in a text file (~5MB) that I want to use with might android application.
The file is of the format:
1|a|This is line 1a
1|b|This is line 1b
2|a|This is line 2a
2|b|This is line 2b
2|c|This is line 2c
What I want to know is the most efficient way (less memory, fast, size etc.) to use this file within my appl...
I want to be able to open up an image file and extra the hexadecimal values byte-by-byte. I have no idea how to do this and googling "python byte editing" and "python byte array" didn't come up with anything, surprisingly. Can someone point me towards the library i need to use, specific methods i can google, or tutorials/guides?
...
I'm having an issue trying to parse the ascii part of a file, and once I hit the end tag, IMMEDIATELY start reading in the bytes from that point on. Everything I know in Java to read off a line or a whole word creates a buffer, which ruins any chance of getting the bytes immediately following my stop point. Is the only way to do this rea...
I'm reading a local file using a BufferedReader wrapped around a FileReader:
BufferedReader reader = new BufferedReader(new FileReader(fileName));
// read the file
// (error handling snipped)
reader.close();
Do I need to close() the FileReader as well, or will the wrapper handle that?
I've seen code where people do something like this...
I am reading a file in groovy using this simple sample code
file.eachLine {line->
// do something with line
}
For example my file has some data like this
blah blah blah
This is some more lines
more lines
Insert into something
(x1,x2,x3)
(Select * from
some table
where
something = something)
on rowid = something;
So I want to rea...
Hello everybody. I am looking for fast class for to work with text files and comfortable reading different object (methods like NextInt32, NextDouble, NextLine, etc). Can you advice me something?
Edit: BinaryReader is bad class in my case. Format of my data is not binary. I have file like
1 2 3
FirstToken NextToken
1.23 2,34
And I wa...
Please look through the below code,
// A.java
File file=new File("blah.txt");
FileWriter fwriter=new FileWriter(file);
PrintWriter pwriter=new PrintWriter(fwriter);
//B.java
File file=new File("blah.txt");
FileWriter fwriter=new FileWriter(file);
BufferedWriter bwriter=new BufferedWriter(bwriter);
What is the difference between these...
In my place where I work, used to have files with more than million rows per file. Even though the server memory are more than 10GB with 8GB for JVM, sometimes the server get hanged for few moments and chokes the other tasks.
I profiled the code and found that while file reading memory use rises in Giga bytes frequently(1GB to 3GB) and ...
My apologies if this is too simple a question, I was unable to google it as it did not like searching for %20.
If I have a URL on which I use the getFile() method to obtain the path for a file I would like to open for processing. If the particular file resides in a directory that contains spaces, the path returned would contains %20 whe...
I am writing a program in Java that requires me to compare the data in 2 files. I have to check each line from file 1 against each line of file 2 and if I find a match write them to a third file. After I read to the end of file 2, how do I reset the pointer to the beginning of the file?
public class FiFo {
public static void main(...
hello guys
I have a file on a jar file; it's 1.txt for example
how can I call it ; my source code is :
Double result=0.0;
try {
File file = new File("1.txt")); //how get this file from a jar file
BufferedReader input =
new BufferedReader(new FileReader(file));
String li...
How would you write this code?
This particular question is about a maze game that has an arraylist of occupants which are Explorers (you), Monsters (touching will kill you), and Treasures. The game uses blocks of square objects in which these occupants reside in. The particular thing I want to do is file reading which can export the cur...
how I can read the following files using the for loop: (can the loop ignore the characters in filenames?)
abc-1.TXT
cde-2.TXT
ser-3.TXT
wsz-4.TXT
aqz-5.TXT
iop-6.TXT
What do I have to add at the beginning of this loop ??
for i = 1:1:6
nom_fichier = strcat(['MyFile\.......' num2str(i) '.TXT']);
...
Hello. I'm having some problems with the FileReader class.
How do I specify an offset in the lines it goes through, and how do I tell it when to stop?
Let's say I want it to go through each line in a .txt file, but only lines 100-200 and then stop?
How would I do this? Right now I'm using ReadLine() but I don't think there's a way to s...
I'm trying to port some of my c++ code into c. I have the following construct
class reader{
private:
FILE *fp;
alot_of_data data;//updated by read_until() method
public:
reader(const char*filename)
read_until(some conditional dependent on the contents of the file, and the arg supplied)
}
Im then instantiating hundreds of these obj...
Scanner s = null;
try {
s = new Scanner(new BufferedReader(new FileReader("rates.txt")));
for (int i=0; i<9; i++){
while(s.hasNext()){rates[i] = s.next();}
System.out.println(rates[i]);
}
}catch (IOException e){
System.out.println(e);
}
finally {
...