Add write method for CSP generator.