[freenet-cvs] r20378 - trunk/apps/WoT/src/plugins/WoT

batosai at freenetproject.org batosai at freenetproject.org
Mon Jun 16 18:34:26 UTC 2008


Author: batosai
Date: 2008-06-16 18:34:26 +0000 (Mon, 16 Jun 2008)
New Revision: 20378

Modified:
   trunk/apps/WoT/src/plugins/WoT/IdentityFetcher.java
Log:
Could someone review this class ? I don't understand why pis contains data in receivedAllData() but not in fetch()... I must be missing something on how InputStreams work.

Modified: trunk/apps/WoT/src/plugins/WoT/IdentityFetcher.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/IdentityFetcher.java	2008-06-16 17:46:10 UTC (rev 20377)
+++ trunk/apps/WoT/src/plugins/WoT/IdentityFetcher.java	2008-06-16 18:34:26 UTC (rev 20378)
@@ -75,9 +75,9 @@
 			fcp.sendMessage(new ClientGet(identity.getFullRequestURI(), identifier));
 			this.wait();
 		}
-		
 		if(fileFetched) {
-			identity.fromXML(pis);
+			//identity.fromXML(pis);
+			System.out.println(pis.available());
 		}
 	}
 	
@@ -195,7 +195,6 @@
 	 */
 	public void receivedDataFound(FcpConnection fcpConnection, DataFound dataFound) {
 		/* empty. */
-		System.out.println("***********DataFound received !");
 	}
 
 	/**
@@ -203,15 +202,21 @@
 	 */
 	public void receivedAllData(FcpConnection fcpConnection, AllData allData) {
 		
-		System.out.println("***********AllData received !");
-		
 		if(allData.getIdentifier().equals(identifier)) {
 			fileFetched = true;
-			pis = allData.getPayloadInputStream();
-			synchronized (this) {
-				notify();
+			this.pis = allData.getPayloadInputStream();
+			
+			try {
+				System.out.println(pis.available());
 			}
+			catch (Exception e) {
+				e.printStackTrace();
+			}
 		}
+		
+		synchronized (this) {
+			notify();
+		}
 	}
 
 	/**
@@ -355,7 +360,7 @@
 	/**
 	 * {@inheritDoc}
 	 */
-	public void connectionClosed(FcpConnection fcpConnection) {
+	public void connectionClosed(FcpConnection fcpConnection, Throwable throwable) {
 		/* empty. */
 	}
 




More information about the cvs mailing list