@ParametersAreNonnullByDefault public class AvatarTranscoder extends Object
A component that can perform the conversion of images from vector (SVG) format to raster format (PNG).
Constructor and Description |
---|
AvatarTranscoder(AvatarManager avatarManager,
AvatarTagger avatarTagger) |
Modifier and Type | Method and Description |
---|---|
File |
getOrCreateRasterizedAvatarFile(Avatar avatar,
Avatar.Size size)
Creates a PNG image file for the given avatar based on the base avatar image file which should be in SVG format.
|
void |
transcodeAndTag(InputStream inputStream,
OutputStream outputStream)
Converts given SVG data to PNG format.
|
byte[] |
transcodeAndTag(String imageKey,
InputStream inputStream,
Avatar.Size size)
Converts a given SVG data to PNG format.
|
public AvatarTranscoder(AvatarManager avatarManager, AvatarTagger avatarTagger)
public File getOrCreateRasterizedAvatarFile(Avatar avatar, Avatar.Size size) throws IOException
avatar
- to be transcodedsize
- of requested rasterIOException
public void transcodeAndTag(InputStream inputStream, OutputStream outputStream) throws IOException
Avatar.Size
.MEDIUM.inputStream
- to be convertedoutputStream
- to which the result should be writtenIOException
public byte[] transcodeAndTag(String imageKey, InputStream inputStream, Avatar.Size size) throws IOException
This method will save the converted image to disk so that if the method is invoked
once again with the same imageKey
and size
the previous result will
be returned. Therefore it is very important to choose imageKey
carefully -
it should uniquely identify the image.
imageKey
- name of the file thatinputStream
- svg datasize
- size of the outputIOException
Copyright © 2002-2015 Atlassian. All Rights Reserved.