Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class ArtFormats

  1. Object
  2. ArtFormats
Opens a graphics document in whichever format it is: PSD or PSB, SVG, Sketch, .cn1gfx, or Figma REST API JSON. The format is found from the bytes, not the name.

Fields

public static final int MAX_BYTES = 536870912The largest file read.

Methods

public static ArtDocument read(InputStream in) throws IOExceptionReads a document.
public static ArtDocument read(byte[] data) throws IOExceptionReads a document from bytes.
public static String detect(byte[] data)The format of a file: “psd”, “svg”, “sketch”, “cn1gfx”, “figma” or null.

Inherited methods

Field details

MAX_BYTES

public static final int MAX_BYTES = 536870912
The largest file read.

Method details

read

public static ArtDocument read(InputStream in) throws IOException
Reads a document.

Parameters

in InputStream
the file; read to its end, not closed

read

public static ArtDocument read(byte[] data) throws IOException
Reads a document from bytes.

Parameters

data byte[]
the file

detect

public static String detect(byte[] data)
The format of a file: “psd”, “svg”, “sketch”, “cn1gfx”, “figma” or null.

Parameters

data byte[]
the start of the file; a few kilobytes are enough