package com.thoughtworks.xstream.io; import com.thoughtworks.xstream.core.util.Cloneables; import com.thoughtworks.xstream.io.naming.NameCoder; import com.thoughtworks.xstream.io.naming.NoNameCoder; /* loaded from: classes.dex */ public abstract class AbstractWriter implements ExtendedHierarchicalStreamWriter { private NameCoder nameCoder; protected AbstractWriter() { this(new NoNameCoder()); } public String encodeAttribute(String str) { return this.nameCoder.encodeAttribute(str); } public String encodeNode(String str) { return this.nameCoder.encodeNode(str); } @Override // com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriter public void startNode(String str, Class cls) { startNode(str); } @Override // com.thoughtworks.xstream.io.HierarchicalStreamWriter public HierarchicalStreamWriter underlyingWriter() { return this; } protected AbstractWriter(NameCoder nameCoder) { this.nameCoder = (NameCoder) Cloneables.cloneIfPossible(nameCoder); } }