|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.file.wrapper.CmsResourceWrapperUtils
public final class CmsResourceWrapperUtils
Helper class with several methods used by different implementations of the
interface I_CmsResourceWrapper
.
It provides methods to add or remove file extensions to resources, to handle creating and writing property files and to add the byte order mask to UTF-8 byte contents.
Field Summary | |
---|---|
static java.lang.String |
EXTENSION_PROPERTIES
The extension to use for the property file. |
static java.lang.String |
SUFFIX_PROP_INDIVIDUAL
The prefix used for a shared property entry. |
static java.lang.String |
SUFFIX_PROP_SHARED
The prefix used for a shared property entry. |
static byte[] |
UTF8_MARKER
The UTF-8 bytes to add to the beginning of text contents. |
Method Summary | |
---|---|
static java.lang.String |
addFileExtension(CmsObject cms,
java.lang.String resourcename,
java.lang.String extension)
Adds a file extension to the resource name. |
static byte[] |
addUtf8Marker(byte[] content)
Adds the UTF-8 marker add the beginning of the byte array. |
static CmsFile |
createPropertyFile(CmsObject cms,
CmsResource res,
java.lang.String path)
Creates a virtual CmsFile with the individual and shared properties as content. |
static java.lang.String |
removeFileExtension(CmsObject cms,
java.lang.String resourcename,
java.lang.String extension)
Removes an added file extension from the resource name. |
static byte[] |
removeUtf8Marker(byte[] content)
Removes the UTF-8 marker from the beginning of the byte array. |
static void |
writePropertyFile(CmsObject cms,
java.lang.String resourcename,
byte[] content)
Takes the content which should be formatted as a property file and set them as properties to the resource. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String EXTENSION_PROPERTIES
public static final java.lang.String SUFFIX_PROP_INDIVIDUAL
public static final java.lang.String SUFFIX_PROP_SHARED
public static final byte[] UTF8_MARKER
Method Detail |
---|
public static java.lang.String addFileExtension(CmsObject cms, java.lang.String resourcename, java.lang.String extension)
If the file with the new extension already exists, an index count will be added before the final extension.
For example: index.html.1.jsp
.
cms
- the actual CmsObjectresourcename
- the name of the resource where to add the file extensionextension
- the extension to add
removeFileExtension(CmsObject, String, String)
public static byte[] addUtf8Marker(byte[] content)
content
- the byte array where to add the UTF-8 marker
public static CmsFile createPropertyFile(CmsObject cms, CmsResource res, java.lang.String path) throws CmsException
For example looks like this:
Title.i=The title of the resource set as individual property
Title.s=The title of the resource set as shared property
cms
- the initialized CmsObjectres
- the resource where to read the properties frompath
- the full path to set for the created property file
CmsException
- if something goes wrongwritePropertyFile(CmsObject, String, byte[])
public static java.lang.String removeFileExtension(CmsObject cms, java.lang.String resourcename, java.lang.String extension)
cms
- the initialized CmsObjectresourcename
- the resource name to remove the file extension fromextension
- the extension to remove
addFileExtension(CmsObject, String, String)
public static byte[] removeUtf8Marker(byte[] content)
content
- the byte array where to remove the UTF-8 marker
public static void writePropertyFile(CmsObject cms, java.lang.String resourcename, byte[] content) throws CmsException
cms
- the initialized CmsObjectresourcename
- the name of the resource where to set the propertiescontent
- the properties to set (formatted as a property file)
CmsException
- if something goes wrongcreatePropertyFile(CmsObject, CmsResource, String)
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |