# find beginning of java class, save out shell script and java class separately.
# The Java classes file starts with "CAFEBABE"

ds= getDataSet('vap+bin:file:///net/spot3/home/jbf/incoming/netbeans-6.5rc2-ml-linux.sh?byteLength=1000000' )

r= where( ds == 0xCA )

r2= where( ds[r+1] == 0xFE )
r= r[r2]

r3= where( ds[r+2] == 0xBA )
r= r[r3]

r4= where( ds[r+3] == 0xBE )
r= r[r4]

index= int(r.value(0))

print 'Index is at ', index
print 'All indeces: ', r

ds.putProperty( QDataSet.DEPEND_0, None )
formatDataSet( ds[0:index], 'vap+bin:file:///home/jbf/temp/installer.sh?type=ubyte' )

print 'done writing shell script part' 

ds= getDataSet('vap+bin:file:///net/spot3/home/jbf/incoming/netbeans-6.5rc2-ml-linux.sh?byteOffset=%d' % index )

ds.putProperty( QDataSet.DEPEND_0, None )
formatDataSet( ds, 'vap+bin:file:///home/jbf/temp/installer.class?type=ubyte' )

print 'done'
