本文整理汇总了Java中org.apache.batik.parser.ParseException类的典型用法代码示例。如果您正苦于以下问题:Java ParseException类的具体用法?Java ParseException怎么用?Java ParseException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParseException类属于org.apache.batik.parser包,在下文中一共展示了ParseException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createValue
import org.apache.batik.parser.ParseException; //导入依赖的package包/类
/**
* Creates a new AnimatableValue from a string.
*/
public AnimatableValue createValue(AnimationTarget target, String ns,
String ln, boolean isCSS, String s) {
try {
short pcInterp = target.getPercentageInterpretation
(ns, ln, isCSS);
parser.parse(s);
return new AnimatableLengthListValue
(target, producer.getLengthTypeArray(),
producer.getLengthValueArray(),
pcInterp);
} catch (ParseException e) {
// XXX Do something better than returning null.
return null;
}
}
示例2: parse
import org.apache.batik.parser.ParseException; //导入依赖的package包/类
/**
* Parse a String value as an SVGAngle.
*/
protected void parse(String s) {
try {
AngleParser angleParser = new AngleParser();
angleParser.setAngleHandler(new DefaultAngleHandler() {
public void angleValue(float v) throws ParseException {
value = v;
}
public void deg() throws ParseException {
setUnitType(SVG_ANGLETYPE_DEG);
}
public void rad() throws ParseException {
setUnitType(SVG_ANGLETYPE_RAD);
}
public void grad() throws ParseException {
setUnitType(SVG_ANGLETYPE_GRAD);
}
});
setUnitType(SVG_ANGLETYPE_UNSPECIFIED);
angleParser.parse(s);
} catch (ParseException e) {
setUnitType(SVG_ANGLETYPE_UNKNOWN);
value = 0;
}
}
示例3: parsePathShape
import org.apache.batik.parser.ParseException; //导入依赖的package包/类
public static Shape parsePathShape(String svgPathShape)
{
try
{
AWTPathProducer pathProducer = new AWTPathProducer();
PathParser pathParser = new PathParser();
pathParser.setPathHandler(pathProducer);
pathParser.parse(svgPathShape);
return pathProducer.getShape();
}
catch (ParseException ex)
{
// Fallback to default square shape if shape is incorrect
return new Rectangle2D.Float(0, 0, 1, 1);
}
}
示例4: string2
import org.apache.batik.parser.ParseException; //导入依赖的package包/类
/**
* Scans a double quoted string.
*/
protected int string2() throws IOException {
start = position;
loop: for (;;) {
switch (nextChar()) {
case -1:
throw new ParseException("eof",
reader.getLine(),
reader.getColumn());
case '"':
break loop;
}
}
nextChar();
return STRING;
}
示例5: parseDur
import org.apache.batik.parser.ParseException; //导入依赖的package包/类
/**
* Parses a new 'dur' attribute.
*/
protected void parseDur(String dur) {
if (dur.equals(SMIL_MEDIA_VALUE)) {
durMedia = true;
simpleDur = UNRESOLVED;
} else {
durMedia = false;
if (dur.length() == 0 || dur.equals(SMIL_INDEFINITE_VALUE)) {
simpleDur = INDEFINITE;
} else {
try {
simpleDur = parseClockValue(dur, false);
} catch (ParseException e) {
throw createException
("attribute.malformed",
new Object[] { null, SMIL_DUR_ATTRIBUTE });
}
if (simpleDur < 0) {
simpleDur = INDEFINITE;
}
}
}
}
示例6: parseValues
import org.apache.batik.parser.ParseException; //导入依赖的package包/类
protected AnimatableValue[] parseValues(String s) {
try {
LengthPairListParser lplp = new LengthPairListParser();
LengthArrayProducer lap = new LengthArrayProducer();
lplp.setLengthListHandler(lap);
lplp.parse(s);
short[] types = lap.getLengthTypeArray();
float[] values = lap.getLengthValueArray();
AnimatableValue[] ret = new AnimatableValue[types.length / 2];
for (int i = 0; i < types.length; i += 2) {
float x = animationTarget.svgToUserSpace
(values[i], types[i], AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH);
float y = animationTarget.svgToUserSpace
(values[i + 1], types[i + 1], AnimationTarget.PERCENTAGE_VIEWPORT_HEIGHT);
ret[i / 2] = new AnimatableMotionPointValue(animationTarget, x, y, 0);
}
return ret;
} catch (ParseException pEx ) {
throw new BridgeException
(ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object[] { SVG_VALUES_ATTRIBUTE, s });
}
}
示例7: parseMax
import org.apache.batik.parser.ParseException; //导入依赖的package包/类
/**
* Parses a new 'max' attribute.
*/
protected void parseMax(String max) {
if (max.equals(SMIL_MEDIA_VALUE)) {
this.max = INDEFINITE;
maxMedia = true;
} else {
maxMedia = false;
if (max.length() == 0 || max.equals(SMIL_INDEFINITE_VALUE)) {
this.max = INDEFINITE;
} else {
try {
this.max = parseClockValue(max, false);
} catch (ParseException ex) {
this.max = INDEFINITE;
}
if (this.max < 0) {
this.max = 0;
}
}
}
}
示例8: parseRepeatDur
import org.apache.batik.parser.ParseException; //导入依赖的package包/类
/**
* Parses a new 'repeatDur' attribute.
*/
protected void parseRepeatDur(String repeatDur) {
try {
if (repeatDur.length() == 0) {
this.repeatDur = UNRESOLVED;
} else if (repeatDur.equals(SMIL_INDEFINITE_VALUE)) {
this.repeatDur = INDEFINITE;
} else {
this.repeatDur = parseClockValue(repeatDur, false);
}
} catch (ParseException ex) {
throw createException
("attribute.malformed",
new Object[] { null, SMIL_REPEAT_DUR_ATTRIBUTE });
}
}
示例9: handleOption
import org.apache.batik.parser.ParseException; //导入依赖的package包/类
public void handleOption(String optionValue, final SVGConverter c) {
try {
ClockParser p = new ClockParser(false);
p.setClockHandler(new ClockHandler() {
public void clockValue(float v) {
handleOption(v, c);
}
});
p.parse(optionValue);
} catch (ParseException e) {
throw new IllegalArgumentException();
}
}
示例10: convertTransform
import org.apache.batik.parser.ParseException; //导入依赖的package包/类
/**
* Returns an AffineTransform according to the specified parameters.
*
* @param e the element that defines the transform
* @param attr the name of the attribute that represents the transform
* @param transform the transform to parse
* @param ctx the BridgeContext to use for error information
*/
public static AffineTransform convertTransform(Element e,
String attr,
String transform,
BridgeContext ctx) {
try {
return AWTTransformProducer.createAffineTransform(transform);
} catch (ParseException pEx) {
throw new BridgeException(ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object[] {attr, transform, pEx });
}
}
示例11: doParse
import org.apache.batik.parser.ParseException; //导入依赖的package包/类
/**
* Parse the attribute associated with this SVGNumberList.
* @param value attribute value
* @param handler list handler
*/
protected void doParse(String value, ListHandler handler)
throws ParseException{
NumberListParser NumberListParser = new NumberListParser();
NumberListBuilder builder = new NumberListBuilder(handler);
NumberListParser.setNumberListHandler(builder);
NumberListParser.parse(value);
}
示例12: curvetoCubicSmoothRel
import org.apache.batik.parser.ParseException; //导入依赖的package包/类
/**
* Implements {@link
* org.apache.batik.parser.PathHandler#curvetoCubicSmoothRel(float,float,float,float)}.
*/
public void curvetoCubicSmoothRel(float x2, float y2,
float x, float y) throws ParseException {
listHandler.item(new SVGPathSegCurvetoCubicSmoothItem
(SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,PATHSEG_CURVETO_CUBIC_SMOOTH_REL_LETTER,
x2,y2,x,y));
}
示例13: revalidate
import org.apache.batik.parser.ParseException; //导入依赖的package包/类
/**
* Initializes the list, if needed.
*/
protected void revalidate() {
if (valid) {
return;
}
valid = true;
missing = false;
malformed = false;
String s = getValueAsString();
if (s == null) {
missing = true;
return;
}
try {
ListBuilder builder = new ListBuilder(this);
doParse(s, builder);
if (builder.getList() != null) {
clear(itemList);
}
itemList = builder.getList();
} catch (ParseException e) {
itemList = new ArrayList(1);
malformed = true;
}
}
示例14: arcAbs
import org.apache.batik.parser.ParseException; //导入依赖的package包/类
/**
* Implements {@link
* org.apache.batik.parser.PathHandler#arcAbs(float,float,float,boolean,boolean,float,float)}.
*/
public void arcAbs(float rx, float ry,
float xAxisRotation,
boolean largeArcFlag, boolean sweepFlag,
float x, float y) throws ParseException {
listHandler.item(new SVGPathSegArcItem
(SVGPathSeg.PATHSEG_ARC_ABS,PATHSEG_ARC_ABS_LETTER,
rx,ry,xAxisRotation,largeArcFlag,sweepFlag,x,y));
}
示例15: parseBegin
import org.apache.batik.parser.ParseException; //导入依赖的package包/类
/**
* Parses a new 'begin' attribute.
*/
protected void parseBegin(String begin) {
try {
if (begin.length() == 0) {
begin = SMIL_BEGIN_DEFAULT_VALUE;
}
beginTimes = TimingSpecifierListProducer.parseTimingSpecifierList
(TimedElement.this, true, begin,
root.useSVG11AccessKeys, root.useSVG12AccessKeys);
} catch (ParseException ex) {
throw createException
("attribute.malformed",
new Object[] { null, SMIL_BEGIN_ATTRIBUTE });
}
}