code: public <T> T getTile4TileCoordinate( final int tx, final int ty, int zoom, Class<T> adaptee ) throws IOException {
          //System.out.println("https://tile.openstreetmap.org/" + zoom + "/" + tx + "/" + ty + ".png");
          Tile tile = new Tile(tx, ty, (byte) zoom, tileSize);
  
          RendererJob mapGeneratorJob = new RendererJob(tile, mapDataStore, renderTheme, displayModel, scaleFactor, false, false);
  
          TileBitmap tb = renderer.executeJob(mapGeneratorJob);
          if (!(tileCache instanceof InMemoryTileCache)) {
              tileCache.put(mapGeneratorJob, tb);
          }
          if (tb instanceof AwtTileBitmap) {
              AwtTileBitmap bmp = (AwtTileBitmap) tb;
              if (bmp != null) {
                  BufferedImage bitmap = AwtGraphicFactory.getBitmap(bmp);
                  if (adaptee.isAssignableFrom(BufferedImage.class)) {
                      return adaptee.cast(bitmap);
                  } else if (adaptee.isAssignableFrom(byte[].class)) {
                      ByteArrayOutputStream baos = new ByteArrayOutputStream();
                      ImageIO.write(bitmap, "png", baos);
                      baos.flush();
                      byte[] imageInByte = baos.toByteArray();
                      baos.close();
                      return adaptee.cast(imageInByte);
                  }
              }
          }
          throw new RuntimeException("Can't handle tilebitmap of type -> " + tb.getClass());
      }
docs: Get tile data for a given tile schema coordinate.
  
  @param tx the x tile index.
  @param ty the y tile index.
  @param zoom the zoomlevel
  @param adaptee the class to adapt to.
  @return the generated data.
  @throws IOException