Package sh.stein.carbon
Class PlaywrightCarbonService
- java.lang.Object
-
- sh.stein.carbon.PlaywrightCarbonService
-
- All Implemented Interfaces:
CarbonService
public class PlaywrightCarbonService extends java.lang.Object implements CarbonService
Interacts with Carbon using Microsoft's Playwright library.
-
-
Constructor Summary
Constructors Constructor Description PlaywrightCarbonService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getImage(java.io.File file)Loads Carbon using Playwright, then screenshots the image created with the specified file's contents and default options.byte[]getImage(java.io.File file, ImageOptions options)Loads Carbon using Playwright, then screenshots the image created with the specified file's contents and options.byte[]getImage(java.lang.String code)Loads Carbon using Playwright, then screenshots the image created with the specified code and default options.byte[]getImage(java.lang.String code, ImageOptions options)Loads Carbon using Playwright, then screenshots the image created with the specified code and options.
-
-
-
Method Detail
-
getImage
public byte[] getImage(java.lang.String code)
Loads Carbon using Playwright, then screenshots the image created with the specified code and default options.- Specified by:
getImagein interfaceCarbonService- Parameters:
code- code to get an image of- Returns:
- the image as a byte array
-
getImage
public byte[] getImage(java.lang.String code, ImageOptions options)Loads Carbon using Playwright, then screenshots the image created with the specified code and options.- Specified by:
getImagein interfaceCarbonService- Parameters:
code- code to get an image ofoptions- anImageOptionsinstance- Returns:
- the image as a byte array
-
getImage
public byte[] getImage(java.io.File file) throws java.io.IOExceptionLoads Carbon using Playwright, then screenshots the image created with the specified file's contents and default options.- Specified by:
getImagein interfaceCarbonService- Parameters:
file- aFileinstance to read the contents of- Returns:
- the image as a byte array
- Throws:
java.io.IOException- if the file cannot be read
-
getImage
public byte[] getImage(java.io.File file, ImageOptions options) throws java.io.IOExceptionLoads Carbon using Playwright, then screenshots the image created with the specified file's contents and options.- Specified by:
getImagein interfaceCarbonService- Parameters:
file- aFileinstance to read the contents ofoptions- anImageOptionsinstance- Returns:
- the image as a byte array
- Throws:
java.io.IOException- if the file cannot be read
-
-