org.das2.qds.buffer.UByteDataSet

Unsigned Byte. This also contains a method for extracting the data at a location as a string.


collectString

collectString( java.nio.charset.Charset charset ) → String

efficiently return the data contained in the bytes presuming a string encoding. This is useful when the data is mostly binary but parts are text data. This is typically used with trim to extract text portions of data. This code shows how the length of each record in a U.S.G.S. DEM file is extracted:

 from java.nio.charset import Charset
 usascii= Charset.forName( 'US-ASCII' )
 ds=getDataSet( 'vap+bin:%s?byteOffset=858&byteLength=6' % fil.toURI() )
 from java.lang import Integer
 ncol= Integer.parseUnsignedInt( ds.collectString( usascii ).strip() )
 print ncol
 

Parameters

charset -

Returns:

the string

See Also:

https://github.com/autoplot/dev/blob/master/demos/20190529/readUsgsDem.jyds


search for examples view on GitHub view source