file-read

Java - Read a big file (few GB) without exception

99封情书 提交于 2019-12-14 04:24:25
问题 This question is very short. I have a File Datei.trec-3,99 GB and i read it with this code: public class Main { public static void main(String[] args) { byte[] content = null; try { content = Files.readAllBytes(Paths.get("D:", "Videos","Captures","Datei.trec")); } catch (IOException e) { e.printStackTrace(); } System.out.println(content); } } and this is the output: Exception in thread "main" java.lang.OutOfMemoryError: Required array size too large at java.nio.file.Files.readAllBytes(Unknown

How to read specific rows/columns of a .CSV file and storing them as a numpy matrix?

元气小坏坏 提交于 2019-12-13 20:42:26
问题 I have a .CSV file with contents like this: DATE OPEN HIGH LOW CLOSE PRICE YCLOSE VOL TICKS 13950309 1000000 1000000 1000000 1000000 1000000 1000000 2100000 74 13950326 1050000 1050010 1050000 1050001 1050000 1000000 1648 5 13950329 1030200 1060000 1030200 1044474 1042265 1050001 28469 108 13950330 1040001 1049999 1040001 1042303 1045001 1044474 6518 10 13950331 1049800 1050000 1048600 1048787 1050000 1042303 277 11 13950401 1059973 1059974 1052000 1053807 1055000 1048787 916 17 13950402

Groovy - Reading files from tomcat server

微笑、不失礼 提交于 2019-12-13 07:47:09
问题 I'm not able to retrieve file contents using Groovy. Below is the code, error in Soapui portnumber = ":8080" extractedValues = new File("//hostname"+"${portnumber}"+"/share/test/working/test.csv").getText('UTF-8') log.info(extractedValues) Error: java.io.FileNotFoundException: \\hostname:8080\share\test\working\test.csv (The network path was not found) error at line: 54 I feel like the issue is with the port number, thus why I'm passing it in a variable. The link itself works when logged on

How to compare an ASCII value

若如初见. 提交于 2019-12-12 21:35:30
问题 I want to store the ASCII value of a letter into a variable, how can I do this? for example : r ASCII variable = 82 main() { character = "character read from a file"; variable= "r ascii"; //(in this case 82), the problem is that the letter is always variable.; printf( "the value of %c is %d, character, variable) } How can I do this? Also on an extra note, how could I read a .txt file character by character? so It could be saved on the character variable. 回答1: Just do: if (r == 82) { //

csv file read - every single character in one single list

孤街浪徒 提交于 2019-12-12 10:49:19
问题 I am rather new to python and could really need some help (I did not find anything that helped me by now). I want to read a csv-file to a list , but unfortunately my output is not as expected. Instead of having a list like: [[Weiz;61744],[Deutschlandsberg;5645]] I have a list that looks like this: [['W'],['e'],['i'], etc.] My code looks like this: def readCSV(file): for row in open(file,"r+"): ftpstream = urllib.request.urlopen(row) csvFile = csv.reader(ftpstream.read().decode('latin-1'))

Reading data from multiple text files [closed]

我只是一个虾纸丫 提交于 2019-12-12 07:25:14
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I am new to Java programming, I am trying to print names, read multiple text files from a folder and counting the word frequency of each word file, when i am reading a folder all the text files are printed but

read huge file line by line in c# [duplicate]

流过昼夜 提交于 2019-12-12 03:23:19
问题 This question already has answers here : Read line by line a large text file and search for a string (2 answers) Closed 4 years ago . I have huge files in c# (more than 300 MB). I need effiecent way to read the file line by line because once I try to read it it takes more than 30 minutes while the target time is around 3 minutes . I tried File.ReadAllBytes which reads the files successfully and very fast and load it to the string. But after that it takes very long time to process the string

Error while reading from a file in MPI C++ programming

五迷三道 提交于 2019-12-11 15:48:22
问题 I`m trying to write a code in C++ and using MPI. In my code, I want to read from a file. I just want the master processor reads the data and later on, I will scatter it to the others. The goal is reading a graph from a file and then scatter its adjacency matrix row-wise. The issue is when I want to open the file. If I generate a matrix it would scatter it nicely ( I used the code from here and changed it based on my need), so I don`t have any issues with scattering as I tested it several

Reading combinations of string and integer from file in C

风格不统一 提交于 2019-12-11 10:33:25
问题 I am novice to C langugage, so please bear with me. I've tried to read a file which contains strings but output obtained is single character. #include <stdio.h> #include <stdlib.h> #include <malloc.h> #define CALLOC(num, type) ((char*)calloc (num, sizeof(char))) #define FREE(addr) (free((void*) (addr))) int i, count; char *x, *y, *z; int main (void) { FILE *stream; if ( (stream = fopen ( "test.txt", "r" )) == NULL ) { printf ("Cannot read the new file\n"); exit (1); } count = 3; x=CALLOC

Where to put a file to read from a class under a package in java?

只谈情不闲聊 提交于 2019-12-11 05:50:13
问题 I have a properties file contains the file name only say file=fileName.dat . I've put the properties file under the class path and could read the file name(file.dat) properly from it in the mainClass . After reading the file name I passed the file name(just name not the path) to another class under a package say pack.myClass to read that file. But the problem is pack.myClass could not get the file path properly. I've put the file fileName.dat both inside and outside the package pack but