15 mistake = err; // save message
16 }
17
18 public String getError() {19 return mistake;20 }21
22}
46
47 }
48
49 public static SVGAbstractTranscoder getTranscoder(MimeType mime)50 throws SVGRasterizerException {5152 SVGAbstractTranscoder transcoder = null;5354 switch (mime) {55 case PNG:56 transcoder = new PNGTranscoder();57 break;58 case JPEG:59 transcoder = new JPEGTranscoder();60 transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,61 new Float(0.9));62 break;63 case PDF:64 transcoder = new PDFTranscoder();65 break;66 default:67 // do nothing68 break;69 }70 71 if(transcoder == null){72 throw new SVGRasterizerException("MimeType not supported");73 }74 75 return transcoder;76 }77}
22 private SVGRasterizer() {
23 }
24
25 public synchronized ByteArrayOutputStream transcode(26 ByteArrayOutputStream stream, String svg, MimeType mime, Float width)27 throws SVGRasterizerException, TranscoderException {2829 TranscoderInput input = new TranscoderInput(new StringReader(svg));30 // Create the transcoder output31 TranscoderOutput transOutput = new TranscoderOutput(stream);32 // get right Transcoder, depends on mime33 SVGAbstractTranscoder transcoder = SVGRasterizer.getTranscoder(mime);34 if (width != null) {35 /*36 * If the raster image height is not provided (using the37 * KEY_HEIGHT), the transcoder will compute the raster image height38 * by keeping the aspect ratio of the SVG document.39 */40 transcoder.addTranscodingHint(SVGAbstractTranscoder.KEY_WIDTH,41 width);42 }43 transcoder.transcode(input, transOutput);4445 return stream;4647 }48
49 public static SVGAbstractTranscoder getTranscoder(MimeType mime)
50 throws SVGRasterizerException {
27
28 public String getType() { return type; }
29
30 public static MimeType get(String type) {31 32 return lookup.get(type); 33 }34}
72
73 }
74
75 protected String selectEncoding(ServletRequest request) {76 return (this.encoding);77 }78
79}
This method does not have any documentation.
Consider adding a documentation comment to explain its use.
While it may seem like the usage of a method is perfectly obvious, any consumers of your API may not be able to pick up on certain details.
This method appears to return an address string based on its name and the return type, but it is hard to say anything further about it. We neither know if the address will be formatted in a special way nor are we given any useful information regarding the returned value.
String getAddress() {
// ...
}
Provide a detailed description of what the method does.
/**
* Returns the address in 3 line format,
* with street address on line 1, area/city on line 2
* and state and country as well as postal code on line 3.
*/
String getAddress() {
// ...
}