@ParametersAreNonnullByDefault public class

AvatarTranscoder

extends Object
java.lang.Object
   ↳ com.atlassian.jira.avatar.AvatarTranscoder

Summary

Public Constructors
AvatarTranscoder(AvatarManager avatarManager, AvatarTagger avatarTagger)
Public Methods
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.
byte[] transcodeAndTag(String imageKey, InputStream inputStream, Avatar.Size size)
Converts a given SVG data to PNG format.
void transcodeAndTag(InputStream inputStream, OutputStream outputStream)
Converts given SVG data to PNG format.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public AvatarTranscoder (AvatarManager avatarManager, AvatarTagger avatarTagger)

Public Methods

public 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. The created file is also saved on disk. The subsequent requests for the same avatar and size will not trigger the conversion, previously saved file will be returned.

Parameters
avatar to be transcoded
size of requested raster
Returns
  • a handle to avatar image file in PNG format
Throws
IOException

public byte[] transcodeAndTag (String imageKey, InputStream inputStream, Avatar.Size size)

Converts a given SVG data to PNG format.

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.

Parameters
imageKey name of the file that
inputStream svg data
size size of the output
Returns
  • byte array containing the PNG image
Throws
IOException

public void transcodeAndTag (InputStream inputStream, OutputStream outputStream)

Converts given SVG data to PNG format. The default avatar size will be used which is Avatar.Size.MEDIUM.

Parameters
inputStream to be converted
outputStream to which the result should be written
Throws
IOException