2 * Copyright (c) 2010-2024 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.http.internal.converter;
15 import java.util.function.Consumer;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.http.internal.http.Content;
19 import org.openhab.core.library.types.RawType;
20 import org.openhab.core.types.Command;
21 import org.openhab.core.types.State;
24 * The {@link ImageItemConverter} implements {@link org.openhab.core.library.items.ImageItem} conversions
26 * @author Jan N. Klug - Initial contribution
30 public class ImageItemConverter implements ItemValueConverter {
31 private final Consumer<State> updateState;
33 public ImageItemConverter(Consumer<State> updateState) {
34 this.updateState = updateState;
38 public void process(Content content) {
39 String mediaType = content.getMediaType();
41 new RawType(content.getRawContent(), mediaType != null ? mediaType : RawType.DEFAULT_MIME_TYPE));
45 public void send(Command command) {
46 throw new IllegalStateException("Read-only channel");