-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FORGE-1633: Introduced WriteableResource
- Loading branch information
Showing
2 changed files
with
46 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
resources/api/src/main/java/org/jboss/forge/addon/resource/WriteableResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Copyright 2014 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.addon.resource; | ||
|
||
import java.io.InputStream; | ||
import java.nio.charset.Charset; | ||
|
||
/** | ||
* A {@link WriteableResource} allows its contents to be changed | ||
* | ||
* @author <a href="ggastald@redhat.com">George Gastaldi</a> | ||
*/ | ||
public interface WriteableResource<T extends WriteableResource<T>> | ||
{ | ||
/** | ||
* Set the contents of this {@link WriteableResource} to the given {@link String} using UTF-8 encoding. | ||
*/ | ||
T setContents(String data); | ||
|
||
/** | ||
* Set the contents of this {@link WriteableResource} to the given {@link String} using the specified encoding. | ||
*/ | ||
T setContents(String data, Charset charset); | ||
|
||
/** | ||
* Set the contents of this {@link WriteableResource} to the given character array using UTF-8 encoding. | ||
*/ | ||
T setContents(char[] data); | ||
|
||
/** | ||
* Set the contents of this {@link WriteableResource} to the given character array using the specified encoding. | ||
*/ | ||
T setContents(char[] data, Charset charset); | ||
|
||
/** | ||
* Set the contents of this {@link WriteableResource} to the contents of the given {@link InputStream}. | ||
*/ | ||
T setContents(InputStream data); | ||
|
||
} |