public class SpoofedTextContentReader extends AbstractContentReader
TextGenerator
AbstractContentAccessor.CallbackFileChannel, AbstractContentAccessor.ChannelCloseCallbackAdvise
Modifier and Type | Field and Description |
---|---|
static String |
KEY_LOCALE |
static String |
KEY_SEED |
static String |
KEY_SIZE |
static String |
KEY_WORDS |
static String |
LEXICON_STEM_PATH |
Constructor and Description |
---|
SpoofedTextContentReader(String url) |
Modifier and Type | Method and Description |
---|---|
static String |
createContentUrl(Locale locale,
long seed,
long size,
String... words)
Helper to create a content URL that represents spoofed text
|
protected org.alfresco.service.cmr.repository.ContentReader |
createReader()
The URL of the write is known from the start and this method contract states
that no consideration needs to be taken w.r.t.
|
boolean |
exists() |
protected ReadableByteChannel |
getDirectReadableChannel()
Provides low-level access to read content from the repository.
|
long |
getLastModified() |
long |
getSeed() |
long |
getSize() |
org.alfresco.textgen.TextGenerator |
getTextGenerator() |
static org.alfresco.textgen.TextGenerator |
getTextGenerator(Locale locale)
Get a text generator for the given locale
|
String[] |
getWords() |
protected void |
setContentUrl(String contentUrl)
Allow derived implementations to set the Content URL.
|
addListener, compareContentReaders, getContent, getContent, getContentInputStream, getContentString, getContentString, getFileChannel, getLimits, getReadableChannel, getReader, getTransformerDebug, getUseBufferedInputStream, isChannelOpen, isClosed, setLimits, setTransformerDebug, setUseBufferedInputStream
channelOpened, finalize, getCallbackFileChannel, getContentData, getContentUrl, getEncoding, getLocale, getMimetype, setEncoding, setLocale, setMimetype, toString
public static final String LEXICON_STEM_PATH
public static final String KEY_LOCALE
public static final String KEY_SEED
public static final String KEY_SIZE
public static final String KEY_WORDS
public SpoofedTextContentReader(String url)
url
- a URL describing the type of text to produce (see class comments)public static org.alfresco.textgen.TextGenerator getTextGenerator(Locale locale)
RuntimeException
- if the locale has no lexicon exists for the localepublic static String createContentUrl(Locale locale, long seed, long size, String... words)
locale
- the text local (must be supported by an appropriate lexicon config resource)seed
- numerical seed to ensure repeatable sequences of random textsize
- the size (bytes) of the text to generatewords
- additional words with decreasing frequencyIllegalArgumentException
- if the resulting URL exceeds 255 characterspublic boolean exists()
public org.alfresco.textgen.TextGenerator getTextGenerator()
public long getSeed()
public String[] getWords()
public long getSize()
public long getLastModified()
File.lastModified()
protected org.alfresco.service.cmr.repository.ContentReader createReader() throws org.alfresco.service.cmr.repository.ContentIOException
createReader
in class AbstractContentReader
org.alfresco.service.cmr.repository.ContentIOException
protected ReadableByteChannel getDirectReadableChannel() throws org.alfresco.service.cmr.repository.ContentIOException
AbstractContentReader
This is the only of the content reading methods that needs to be implemented by derived classes. All other content access methods make use of this in their underlying implementations.
getDirectReadableChannel
in class AbstractContentReader
org.alfresco.service.cmr.repository.ContentIOException
- if the channel could not be opened or the underlying content
has disappearedprotected final void setContentUrl(String contentUrl)
AbstractContentAccessor
setContentUrl
in class AbstractContentAccessor
contentUrl
- the new content URLCopyright © 2005–2017 Alfresco Software. All rights reserved.