Overview | Package | Class | Deprecated | Index | Help
| Groovy 1.7.0
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## groovy.lang
Class GroovyCodeSource

    java.lang.Object
      groovy.lang.GroovyCodeSource

    class GroovyCodeSource
    extends Object

CodeSource wrapper class that allows specific security policies to be associated with a class compiled from groovy source.

author:
  Steve Goetze

author:
  Guillaume Laforge

Field Summary
`Certificate[]` | `certs` The certificates used to sign the items from the codesource

Constructor Summary
`GroovyCodeSource(String script, String name, String codeBase)`
`GroovyCodeSource(Reader reader, String name, String codeBase)` Construct a GroovyCodeSource for an inputStream of groovyCode that has an unknown provenance -- meaning it didn't come from a File or a URL (e.g.
`GroovyCodeSource(InputStream inputStream, String name, String codeBase)` Construct a GroovyCodeSource for an inputStream of groovyCode that has an unknown provenance -- meaning it didn't come from a File or a URL (e.g.
`GroovyCodeSource(File infile, String encoding)`
`GroovyCodeSource(File infile)`
`GroovyCodeSource(URL url)`

Method Summary
`CodeSource` | `getCodeSource()`
`File` | `getFile()`
`InputStream` | `getInputStream()`
`String` | `getName()`
`String` | `getScriptText()`
`boolean` | `isCachable()`
`void` | `setCachable(boolean b)`

Methods inherited from class Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll

Field Detail

### certs

    Certificate[] certs

  The certificates used to sign the items from the codesource

Constructor Detail

### GroovyCodeSource

    public GroovyCodeSource(String script, String name, String codeBase)

### GroovyCodeSource

    public GroovyCodeSource(Reader reader, String name, String codeBase)

  Construct a GroovyCodeSource for an inputStream of groovyCode that has an unknown provenance -- meaning it didn't come from a File or a URL (e.g. a String). The supplied codeBase will be used to construct a File URL that should match up with a java Policy entry that determines the grants to be associated with the class that will be built from the InputStream. The permission groovy.security.GroovyCodeSourcePermission will be used to determine if the given codeBase may be specified. That is, the current Policy set must have a GroovyCodeSourcePermission that implies the codeBase, or an exception will be thrown. This is to prevent callers from hijacking existing codeBase policy entries unless explicitly authorized by the user.

### GroovyCodeSource

    @Deprecated
    	public
    public GroovyCodeSource(InputStream inputStream, String name, String codeBase)

  Construct a GroovyCodeSource for an inputStream of groovyCode that has an unknown provenance -- meaning it didn't come from a File or a URL (e.g. a String). The supplied codeBase will be used to construct a File URL that should match up with a java Policy entry that determines the grants to be associated with the class that will be built from the InputStream. The permission groovy.security.GroovyCodeSourcePermission will be used to determine if the given codeBase may be specified. That is, the current Policy set must have a GroovyCodeSourcePermission that implies the codeBase, or an exception will be thrown. This is to prevent callers from hijacking existing codeBase policy entries unless explicitly authorized by the user.
  deprecated:
    Prefer using methods taking a Reader rather than an InputStream to avoid wrong encoding issues.

### GroovyCodeSource

    public GroovyCodeSource(File infile, String encoding)

### GroovyCodeSource

    public GroovyCodeSource(File infile)

  param:
    infile the file to create a GroovyCodeSource for.
  throws:
    IOException if an issue arises opening and reading the file.

### GroovyCodeSource

    public GroovyCodeSource(URL url)

Method Detail

### getCodeSource

    public CodeSource getCodeSource()

### getFile

    public File getFile()

### getInputStream

    @Deprecated
    	public
    public InputStream getInputStream()

  deprecated:
    Prefer using methods taking a Reader rather than an InputStream to avoid wrong encoding issues.

### getName

    public String getName()

### getScriptText

    public String getScriptText()

### isCachable

    public boolean isCachable()

### setCachable

    public void setCachable(boolean b)

Copyright © 2003-2009 The Codehaus. All rights reserved.