  >>> from liblas import file
  >>> f = file.File('../test/data/TO_core_last_clip.las')
  
  >>> f.header # doctest: +ELLIPSIS
  <liblas.header.Header object at ...>
  
  >>> f.header.point_records_count
  8L
  
  >>> header = f.header
  >>> p = f.read(0)
  >>> p.x, p.y, p.z
  (630262.30000000005, 4834500.0, 51.530000000000001)
  
  >>> p = f.read(6)
  >>> p.x, p.y, p.z
  (630320.95999999996, 4834500.0, 55.009999999999998)
  
  >>> points = []
  >>> for i in f:
  ...   points.append(i)
  ...   print i # doctest: +ELLIPSIS
  <liblas.point.Point object at ...>
  <liblas.point.Point object at ...>
  <liblas.point.Point object at ...>
  <liblas.point.Point object at ...>
  <liblas.point.Point object at ...>
  <liblas.point.Point object at ...>
  <liblas.point.Point object at ...>
  <liblas.point.Point object at ...>

  >>> len(points)
  8

  >>> for p in points:
  ...   print p.x, p.y
  630262.3 4834500.0
  630282.45 4834500.0
  630300.08 4834500.0
  630346.83 4834500.0
  630327.59 4834500.0
  630323.57 4834500.0
  630320.96 4834500.0
  630280.89 4834500.0

  >>> points = []
  >>> for i in f:
  ...   points.append(i)
  ...   print i # doctest: +ELLIPSIS
  <liblas.point.Point object at ...>
  <liblas.point.Point object at ...>
  <liblas.point.Point object at ...>
  <liblas.point.Point object at ...>
  <liblas.point.Point object at ...>
  <liblas.point.Point object at ...>
  <liblas.point.Point object at ...>
  <liblas.point.Point object at ...>


  >>> len(points)
  8  

  >>> del f
  
  >>> f = file.File('junk.las', mode="w", header=header)
  >>> sum(header.offset)
  0.0
  >>> header.min
  [630262.30000000005, 4834500.0, 50.899999999999999]

  >>> for i in points:
  ...    f.write(i)
  
  >>> pts = file.File('junk.las')
  Traceback (most recent call last):
  ...
  LASException: ('File %s is already open.  Close the file or delete the reference to it', 'junk.las')
  
  >>> f.close()
  >>> f.header

  >>> del f
  >>> f = file.File('junk.las', mode='w+', header=header)
  
  >>> for i in points:
  ...    f.write(i)
  
  >>> f.close()
  
  >>> f = file.File('junk.las')
  >>> cnt = 0
  >>> for i in f:
  ...     cnt += 1
  
  >>> cnt
  16
  
  >>> f.close()
  >>> import os
  >>> os.remove('junk.las')