[jboss-jira] [JBoss JIRA] Created: (JBCACHE-1289) VersionAwareMarshalle.objectFromStream implemention uses unreliable InputStream.available

Elias Ross (JIRA) jira-events at lists.jboss.org
Thu Feb 7 17:54:03 EST 2008


VersionAwareMarshalle.objectFromStream implemention uses unreliable InputStream.available
-----------------------------------------------------------------------------------------

                 Key: JBCACHE-1289
                 URL: http://jira.jboss.com/jira/browse/JBCACHE-1289
             Project: JBoss Cache
          Issue Type: Bug
      Security Level: Public (Everyone can see)
            Reporter: Elias Ross
         Assigned To: Manik Surtani



InputStream.available() may return less than the complete number of bytes available on the stream. The following does not work:

   @Override
   public Object objectFromStream(InputStream is) throws Exception
   {
      int avbl = is.available(); // MAY RETURN 1 !
      byte[] bytes = new byte[avbl];
      is.read(bytes, 0, avbl);
      return objectFromByteBuffer(bytes);
   }

I want to be able to stream objects from the Amazon S3 service. The following does not work either:

	  ObjectInputStream ois = new MarshalledValueInputStream(is);
	  short versionId = ois.readShort();
      Marshaller marshaller = getMarshaller(versionId);
      return marshaller.objectFromObjectStream(ois);

I'm guessing ReusableObjectInputStream needs to be used and changed to actually support streams, not byte arrays! But I'm not too familiar with the mechanics.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list