001package jmri.jmrix.internal;
002
003import javax.annotation.Nonnull;
004
005import jmri.StringIO;
006
007import jmri.implementation.DefaultStringIO;
008
009/**
010 * Implement a StringIOManager for "Internal" (virtual) StringIOs.
011 *
012 * @author Bob Jacobsen      Copyright (C) 2009
013 * @author Daniel Bergqvist  Copyright (C) 2020
014 */
015public class InternalStringIOManager extends jmri.managers.AbstractStringIOManager {
016
017    public InternalStringIOManager(InternalSystemConnectionMemo memo) {
018        super(memo);
019    }
020
021    /**
022     * {@inheritDoc}
023     */
024    @Override
025    @Nonnull
026    public InternalSystemConnectionMemo getMemo() {
027        return (InternalSystemConnectionMemo) memo;
028    }
029
030    @Override
031    @Nonnull
032    public StringIO provideStringIO(@Nonnull String sName) throws IllegalArgumentException {
033        return new DefaultStringIO(sName);
034    }
035
036    /** {@inheritDoc} */
037    @Override
038    @Nonnull
039    public StringIO provide(@Nonnull String name) throws IllegalArgumentException { 
040        return provideStringIO(name); 
041    }
042
043    @Override
044    @Nonnull
045    public StringIO createNewStringIO(String sName, String uName) {
046        return new DefaultStringIO(sName, uName);
047    }
048}