- Joined
- Nov 25, 2008
- Messages
- 1,309
DSG: what's your thoughts on std::fstream? (or ifstream/ofstream)
Turns out thats bullshit.Its deprecated because it only supports 2GB files [...]
They never wanted to remove it, which is why nothing i used has an @Deprecated annotation.Since it is so heavily used, they could not remove it or change it so instead they added nio, short for New Input Output.
Turns out this is bullshit as well. All of this. java.io is an ALTERNATIVE to java.nio. The two packages have different designs (stream oriented vs. buffer oriented), and while java.nio is certainly a lot faster (heard claims of >250% speedup), it doesnt matter if the bottleneck is not I/O.New Java programs should avoid the old io in favour of nio. Adapters exist to convert between the two stream formats however these are only for compatibility. In reality Java does file IO only using nio Classes. The ones you see in io package are wrappers around nio Classes.
Um maybe you did not understand me. io has no seek method for very large files, nio does. io requires you to skip forward (or backwards?) by an int amount, nio uses a long absolute position. Although in this case where you are reading a stream file it makes no difference since everything has to be read sequentially, it does make a difference for an MPQ reader as there you are reading chunks at random.Turns out thats bullshit.
They never can remove it, it is too heavily in use to ever be removed. Only Java 2.0 could consider removing it but that is currently never planned.They never wanted to remove it, which is why nothing i used has an @Deprecated annotation.
Java io came first and has been with Java pretty much since the start, nio was made as an official package then added into the standard edition due to a combination of popular demand and requirement.All of this. java.io is an ALTERNATIVE to java.nio.
Which in this case it likely will be since you are parsing a file.it doesnt matter if the bottleneck is not I/O.
FileInputStream.skip()Um maybe you did not understand me. io has no seek method for very large files, nio does. io requires you to skip forward (or backwards?) by an int amount, nio uses a long absolute position. Although in this case where you are reading a stream file it makes no difference since everything has to be read sequentially, it does make a difference for an MPQ reader as there you are reading chunks at random.
They can still officially deprecate it. Which they have not done. So you pick the tool thats best for the job, and thats not necessarily java.nio.They never can remove it, it is too heavily in use to ever be removed. Only Java 2.0 could consider removing it but that is currently never planned.
You do realize this is a simple proof of concept parser? I hope you also realize that the files that are going to be parsed are on the order of hundreds of KiB in size? I hope you also realize that this parser is useless without something around it, and im taking a guess here and say that anything useful is going to have bottlenecks other than I/O (i might very well be wrong, but unless you plan on parsing hundreds of MiB, you wont notice when a file is loaded once)?Which in this case it likely will be since you are parsing a file.
Wonderful, I love how you all actually participated for the last question ^.^
We should have more codegulf-like things around here
We have introduced you to programming, you are already dead
Check out Project Euler.I wouldn't mind coding more, it'd be fun to have a quiz question that must be answered with something other than gui/jass/vjass coding wise.
I want to make a third party editor, in C++, with plugin functionality in lua i think, idk on plugins.
So i'm slowly writing a parser for every map file.
but the tool chain isn't specifically linked to that, so we can combine ;D.
What are you using for parsing?
Give a pair of strings that return the same hash when passed to it.
[3 Rep] Give a pair of strings that return the same hash when passed to it.
so where is my rep?
I really need it, im planning to have more rep than DSG till the end of the year.