001/*
002 * To change this template, choose Tools | Templates
003 * and open the template in the editor.
004 */
005package org.anarres.qemu.exec.host.chardev;
006
007import java.io.File;
008import java.util.Map;
009import javax.annotation.Nonnull;
010
011/**
012 *
013 * @author shevek
014 */
015public class NamedPipeCharDevice extends AbstractCharDevice {
016
017    private final File file;
018
019    public NamedPipeCharDevice(@Nonnull File file) {
020        super("pipe");
021        this.file = file;
022    }
023
024    public NamedPipeCharDevice(@Nonnull String path) {
025        this(new File(path));
026    }
027
028    @Override
029    protected void addProperties(Map<String, Object> m) {
030        super.addProperties(m);
031        m.put("path", file.getAbsolutePath());
032    }
033
034    @Override
035    public String toString() {
036        return "pipe:" + file.getAbsolutePath();
037    }
038}