[hydra-commits] beagles: branch ice/slice-preserving-translators r586 - /ice/branches/slice-p...

SVN commits to the Hydra project hydra-commits at lists.digium.com
Fri Apr 23 17:53:37 CDT 2010


Author: beagles
Date: Fri Apr 23 17:53:36 2010
New Revision: 586

URL: https://origsvn.digium.com/svn-view/hydra?view=rev&rev=586
Log:
adding runtime support for a 'preserve' metadata tag to create unsliceable class and exception hierarchies (first rough cut)

Modified:
    ice/branches/slice-preserving-translators/java/src/IceInternal/BasicStream.java

Modified: ice/branches/slice-preserving-translators/java/src/IceInternal/BasicStream.java
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/java/src/IceInternal/BasicStream.java?view=diff&rev=586&r1=585&r2=586
==============================================================================
--- ice/branches/slice-preserving-translators/java/src/IceInternal/BasicStream.java (original)
+++ ice/branches/slice-preserving-translators/java/src/IceInternal/BasicStream.java Fri Apr 23 17:53:36 2010
@@ -608,6 +608,34 @@
         }
         expand(len);
         _buf.b.put(v, off, len);
+    }
+
+    public byte[]
+    getSkippedSlices()
+    {
+	if(_currentObjectStart < _currentSliceStart)
+	{
+	    int returnTo = _buf.b.position();
+	    try
+	    {
+		try
+		{
+		    byte[] result = new byte[_currentSliceStart - _currentObjectStart];
+		    _buf.b.position(_currentObjectStart);
+		    _buf.b.get(result);
+		    return result;
+		}
+		catch(Exception ex)
+		{
+		    ex.printStackTrace();
+		}
+	    }
+	    finally
+	    {
+		_buf.b.position(returnTo);
+	    }
+	}
+	return null;
     }
 
     public byte[]
@@ -1424,6 +1452,7 @@
             throw new Ice.MarshalException("Invalid class instance index");
         }
 
+	_currentObjectStart = _currentSliceStart = _buf.b.position();
         String mostDerivedId = readTypeId();
         String id = mostDerivedId;
 
@@ -1492,6 +1521,7 @@
                         TraceUtil.traceSlicing("class", id, _slicingCat, _instance.initializationData().logger);
                     }
                     skipSlice(); // Slice off this derived part -- we don't understand it.
+		    _currentSliceStart = _buf.b.position();
                     id = readTypeId(); // Read next id for next iteration.
                     continue;
                 }
@@ -2408,6 +2438,9 @@
     private int _readSlice;
     private int _writeSlice;
 
+    private int _currentObjectStart;
+    private int _currentSliceStart;
+
     private int _traceSlicing;
     private String _slicingCat;
 





More information about the asterisk-scf-commits mailing list