src/JavaVM.st
branchjk_new_structure
changeset 1544 440d87ed6537
parent 1538 baa8e06aac40
child 1545 1ded666190e2
--- a/src/JavaVM.st	Mon Jul 23 09:43:13 2012 +0000
+++ b/src/JavaVM.st	Mon Jul 23 15:53:46 2012 +0000
@@ -2664,6 +2664,64 @@
     "Created: / 25-02-2011 / 08:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!JavaVM class methodsFor:'debugging-dumping'!
+
+dumpOpenExternalStream: stream on: output
+    output nextPutAll: stream class printString.
+    output space.
+    OpenFileTable notNil ifTrue:[
+        | idx |
+        idx := OpenFileTable identityIndexOf: stream.
+        idx ~~ 0 ifTrue:[
+            output nextPutAll:'JavaVM:OpenFileTable['; nextPutAll: idx printString; nextPut:$]; space.
+        ]
+    ].
+    ZipCache notNil ifTrue:[
+        | idx |
+        idx := ZipCache identityIndexOf: stream.
+        idx ~~ 0 ifTrue:[
+            output nextPutAll:'JavaVM:ZipCache['; nextPutAll: idx printString; nextPut:$]; space.
+        ]
+    ].
+    stream isFileStream ifTrue:[
+        output nextPutAll: stream pathName ? '?'
+    ]
+
+    "Created: / 23-07-2012 / 16:40:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+dumpOpenExternalStreams
+    ^self dumpOpenExternalStreamsOn: Stdout.
+
+    "Created: / 23-07-2012 / 16:32:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+dumpOpenExternalStreamsOn: aStream
+
+    | nOpenStreams |
+
+    nOpenStreams := 0.
+    ExternalStream allSubInstancesDo:[:each|
+        each isOpen ifTrue:[
+            nOpenStreams := nOpenStreams + 1.
+            self dumpOpenExternalStream: each on: aStream.
+            aStream cr.
+        ]
+    ].
+    aStream nextPutLine: 
+        ('SUMMARY: open=%1, java.io=%2, java.util.zip=%3'
+            bindWith: nOpenStreams
+                with: ((OpenFileTable ? #()) inject:0 into:[:a :s|a + (s notNil ifTrue:[1] ifFalse:[0])])
+                with: ((ZipCache ? #())      inject:0 into:[:a :s|a + (s notNil ifTrue:[1] ifFalse:[0])])
+        )
+
+    "
+        JavaVM dumpOpenExternalStreamsOn: Stdout
+    "
+
+    "Created: / 23-07-2012 / 16:34:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !JavaVM class methodsFor:'defaults'!
 
 audioEnabled