public class RepositoryUtilities extends Object
Modifier and Type | Method and Description |
---|---|
static String |
buildName(ContentEntity entity,
String separator)
Builds a string of an absolute pathname for the given entity and using the given separator to separate filename
segments..
|
static String[] |
buildNameArray(ContentEntity entity)
Builds a absolute pathname for the given entity.
|
static ContentItem |
createItem(Repository repository,
String[] name)
Tries to create a content item with the given path-name in the repository.
|
static ContentLocation |
createLocation(Repository repository,
String[] name)
Tries to create a content location with the given path-name in the repository.
|
static ContentEntity |
getEntity(Repository repository,
String[] name)
Returns the content entity for the given path name.
|
static int |
getZipLevel(ContentItem item)
Computes the declared Zip-Compression level for the given content-item.
|
static int |
getZipMethod(ContentItem item)
Computes the declared Zip-Compression mode for the given content-item.
|
static boolean |
isExistsEntity(Repository repository,
String[] name)
Checks whether a given pathname points to a valid content entity.
|
static boolean |
isInvalidPathName(String name)
Checks whether the given entity name is valid for filesystems.
|
static String[] |
split(String name,
String separator)
Splits a string on the given separator.
|
static String[] |
splitPath(String name,
String separator)
Splits a string on the given separator.
|
static void |
writeAsZip(OutputStream outputStream,
Repository repository)
Writes the given repository as ZIP-File into the given output stream.
|
static void |
writeToZipStream(ZipOutputStream zipOutputStream,
Repository repository)
Writes the given repository to the given ZIP-output stream.
|
public static ContentEntity getEntity(Repository repository, String[] name) throws ContentIOException
repository
- the repository from where to retrieve the content entity.name
- the path name as array of name-segments.ContentIOException
- if the path did not point to a valid content entity.splitPath(String, String)
public static boolean isExistsEntity(Repository repository, String[] name) throws ContentIOException
repository
- the repository from where to retrieve the content entity.name
- the path name as array of name-segments.ContentIOException
- if an unexpected repository error occured.splitPath(String, String)
public static ContentItem createItem(Repository repository, String[] name) throws ContentIOException
repository
- the repository in which a new entity should be created.name
- the name of the new entity as path name.ContentIOException
- if an repository error occured or if the path was not valid.public static ContentLocation createLocation(Repository repository, String[] name) throws ContentIOException
repository
- the repository in which a new entity should be created.name
- the name of the new entity as path name.ContentIOException
- if an repository error occured or if the path was not valid.public static String[] splitPath(String name, String separator)
name
- the path name.separator
- the separator on which to split.public static String[] split(String name, String separator)
name
- the path name.separator
- the separator on which to split.public static String[] buildNameArray(ContentEntity entity)
entity
- the entity for which the pathname should be computed.public static String buildName(ContentEntity entity, String separator)
entity
- the entity for which the pathname should be computed.separator
- the filename separator.public static boolean isInvalidPathName(String name)
name
- the filename that should be tested. This name must be a single name section, not a full path.public static void writeAsZip(OutputStream outputStream, Repository repository) throws IOException, ContentIOException
outputStream
- the output stream that should receive the zipfile.repository
- the repository that should be written.IOException
- if an IO error prevents the writing of the file.ContentIOException
- if a repository related IO error occurs.public static void writeToZipStream(ZipOutputStream zipOutputStream, Repository repository) throws IOException, ContentIOException
zipOutputStream
- the output stream that represents the ZipFile to be generated.repository
- the repository that should be written.IOException
- if an IO error prevents the writing of the file.ContentIOException
- if a repository related IO error occurs.public static int getZipLevel(ContentItem item)
item
- the content item for which the compression factor should be computed.public static int getZipMethod(ContentItem item)
item
- the content item for which the compression mode should be computed.