Package org.codehaus.commons.compiler.util.resource

# Class MapResourceCreator

java.lang.Object
org.codehaus.commons.compiler.util.resource.MapResourceCreator

All Implemented Interfaces:
  `ResourceCreator`

public class MapResourceCreator extends Object implements ResourceCreator
Creates resources as byte arrays in a delegate `Map`.

## Constructor Summary

Constructors
Constructor
Description
`MapResourceCreator()`
Auto-create the delegate `Map`.
`MapResourceCreator(Map<String,byte[]> map)`

## Method Summary

Modifier and Type
Method
Description
`final OutputStream`
`createResource(String resourceName)`
Creates the designated resource.
`final boolean`
`deleteResource(String resourceName)`
Deletes the resource with the given name.
`final Map<String,byte[]>`
`getMap()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### MapResourceCreator

public MapResourceCreator()
Auto-create the delegate `Map`.

### MapResourceCreator

public MapResourceCreator(Map<String,byte[]> map)

Parameters:
  `map` - String fileName => byte[] data

## Method Details

### getMap

public final Map<String,byte[]> getMap()

Returns:
  The `String`-to-`byte[]` map of the resources created

### createResource

public final OutputStream createResource(String resourceName)
Description copied from interface: `ResourceCreator`
Creates the designated resource.

Specified by:
  `createResource` in interface `ResourceCreator`
Parameters:
  `resourceName` - Designates the resource; typically structured by slashes ("/") like "`com/foo/pkg/Bar.class`"
Returns:
  Bytes written to this `OutputStream` are stored in the resource

### deleteResource

public final boolean deleteResource(String resourceName)
Description copied from interface: `ResourceCreator`
Deletes the resource with the given name.

Specified by:
  `deleteResource` in interface `ResourceCreator`
Returns:
  `false` if the resource could not be deleted