public class ContentParserOptionsBean extends Object implements ContentParserOptions
ContentParserOptions
as simple java
bean.Modifier and Type | Field and Description |
---|---|
private boolean |
disableUtfDetection |
private String |
encoding |
private int |
maximumBufferSize |
MAXIMUM_BUFFER_SIZE_DEFAULT
Constructor and Description |
---|
ContentParserOptionsBean()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
getEncoding()
This method gets the encoding used as fallback, if it can NOT be derived or
detected automatically.
|
int |
getMaximumBufferSize()
This method gets the maximum size used for buffers when parsing content.
|
boolean |
isDisableUtfDetection()
This method determines if the automatic detection of UTF-encodings
(unicode) shall be disabled.
|
void |
setDisableUtfDetection(boolean disableUnicodeDetection) |
void |
setEncoding(String encoding) |
void |
setMaximumBufferSize(int maximumBufferSize) |
private int maximumBufferSize
getMaximumBufferSize()
private String encoding
getEncoding()
private boolean disableUtfDetection
isDisableUtfDetection()
public int getMaximumBufferSize()
char
s will use at least two bytes so e.g.
StringBuffer
s shall be allocated
with a capacity
at most
maxBytes/2
. Anyways the amount of memory allocated will
typically be at least twice a much as maxBytes
. E.g. a
StringBuilder
is created with a capacity
of maxBytes/2
then StringBuilder.toString()
may allocate another array of about that size. This is a legal behavior of
the ContentParser
. So if you want to limit your heap-size use a
reasonable lower value for maxBytes
. Please do NOT use values
lower than 1024 (You do NOT want to parse Word-Documents with J2ME on your
toaster, do you?).getMaximumBufferSize
in interface ContentParserOptions
ContentParserOptions.MAXIMUM_BUFFER_SIZE_DEFAULT
public void setMaximumBufferSize(int maximumBufferSize)
maximumBufferSize
- is the maximumBufferSize to setpublic String getEncoding()
not disabled
. By default
UTF detection is enabled
and the encoding
is The default is
EncodingUtil.SYSTEM_DEFAULT_ENCODING
but
replaced by
EncodingUtil.ENCODING_ISO_8859_15
if
UTF-based.getEncoding
in interface ContentParserOptions
public void setEncoding(String encoding)
encoding
- is the encoding to setpublic boolean isDisableUtfDetection()
encoding
. Otherwise it will be
treaded as fallback if textual files do not seem to be unicode (UTF).isDisableUtfDetection
in interface ContentParserOptions
true
if unicode detection shall be disabled,
false
if enabled (default).public void setDisableUtfDetection(boolean disableUnicodeDetection)
disableUnicodeDetection
- is the disableUnicodeDetection to setCopyright © 2001–2016 mmm-Team. All rights reserved.