[Talk-de] Pbf > 4 Gig Java - Problem schon irgendwo gelöst?

Carsten Moeller cmindividual at gmx.de
So Mai 1 20:55:49 UTC 2011


Am 01.05.2011 22:45, schrieb Chris66:
> Am 01.05.2011 22:13, schrieb Carsten Moeller:
>> Am 01.05.2011 22:08, schrieb Henning Scholland:
>>> Ist in osmosis 0.39 gefixt.
>>
>> Bevor ich jetzt mein SVN bemuehen muss...
>> Eine Idee, was der Grund war?
>
> Es wurde die 'available' Funktion benutzt, die unter Windows bei
> Dateigrößen ab 4 GB anscheinend anders als unter Linux arbeitet.
>
> *int* available()
>
> Returns an *estimate* of the number of bytes that can be read (or
> skipped over) from this input stream without blocking by the next
> invocation of a method for this input stream.
>
> Fettung von mir (soll verdeutlichen, dass man diese Funktion
> bei großen Dateien lieber meiden sollte).
>
> Chris

Vielen Dank, Chris.
Ja ja, ..., available() ... ein guter, böser alter Bekannter ;-)
Hab's auch gerade herausgefunden und gleich eingecheckt.
Jetzt läuft mein Europa ... Gerade bei Knoten Nr. 300 Mio.
... 180 kommen noch. Mal schauen ...

Hier nochmal der Patch:

Index: BlockInputStream.java
===================================================================
--- BlockInputStream.java	(revision 1065)
+++ BlockInputStream.java	(working copy)
@@ -17,6 +17,7 @@

  package crosby.binary.file;

+import java.io.EOFException;
  import java.io.IOException;
  import java.io.InputStream;

@@ -28,10 +29,13 @@
      }

      public void process() throws IOException {
-        while (input.available() > 0) {
-            FileBlock.process(input, adaptor);
+      try {
+        while (true) {
+          FileBlock.process(input, adaptor);
          }
+      } catch (EOFException e) {
          adaptor.complete();
+      }
      }

      public void close() throws IOException {






Mehr Informationen über die Mailingliste Talk-de