Pio Jac

Greenhorn
+ Follow
since May 03, 2012
Pio likes ...
IntelliJ IDE Java
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pio Jac

Yes, it has done its work. I'm always forgetting about closing such things. Thank you for your help!
11 years ago
Hi,
I have a simple code to change dots to commas in a specific lines of a file, writing copy of a file with corrections. Basically it works fine, but I have unfortunately a weird problem. BufferedWriter doesn't write whole destination file. It ends between 99-100% of whole file (all files are 5.2-5.3 MB of size) right in the middle of a line. No exceptions.

I don't have any idea what to do with it, so I'm welcome to any suggestions - even to change BufferedReader/BufferedWriter to something more appropriate in this situation. I also have to notice that I use BufferedReader to read those source files in another part of code, I'm writing their contents to search engine index and I have seen 100% of files content loaded there (by looking for text in last parts of files), so there's probably no problem with BufferedReader.

source file part:

SNS dawała nie formalne poparcie rządowi za sprawą szefa partii Ludovita Cernaka. SNS nie wchodząc w skład oficjalnej rządowej koalicji zażądała od obozu rządzącego uregulowania sprawy i podpisania oficjalnej koalicji, takie same żądania wysunęła lewicowa SDL. Partia Cernaka weszła w skłąd rządu i objęła cztery resorty - lider otrzymał tekę ministra ekonomii. W 1994 roku prezydentem został Michal Kovac który miał nienajlepsze stosunki z premierem Vladimira Meclarem. Skutkiem tego było votum nieufności dla rządu ale opozycja która przejęła władzę nie potrafiła się dogadać między sobą i w tym samym roku doszło do kolejnych przeddterminowych wyborów.

[...and about 150 more lines of text to the end]



destination file end:

SNS dawała nie formalne poparcie rządowi za sprawą szefa partii Ludovita Cernaka. SNS nie wchodząc w skład oficjalnej rządowej koalicji zażądała od obozu rządzącego uregulowania sprawy i podpisania oficjalnej koalicji, takie same żądania wysunęła lewicowa SDL. Partia Cernaka weszła w skłąd rządu i objęła cztery resorty - lider otrzymał tekę min



Here's whole source code (but I think that problem lays not in code, but in using BufferedReader / BufferedWriter for such files).


Here's HEX output of part where BufferedWriter stops to write file:
11 years ago
With StreamGobbler class from last (4th) page of article and slight modification to presented code it worked like a charm.


Thank you for your help!
11 years ago
Hi,
I've been looking through many similar topics, but haven't found anything according to my situation. Now my code looks like that:

My process (maca-analyse) starts, it works (it's a long-working process, so I can see it using linux top command), but when it suspends after successful execution, nothing happens in Java - p.waitFor() still works and waits... for nothing. Problem started to happen when I included file in and file out at the end of command. I tried

/bin/sh -c 'maca-analyse morfeusz-nkjp-official-guesser -o ccl < /home/iceman/wikidump/plwiki-latest-pages-articles.xml-076.txt > ../wikidump/maca.txt'


in terminal. It works and in the end gives back console prompt. Then what's wrong with my Java code?
11 years ago