45 lines
1.2 KiB
Java
45 lines
1.2 KiB
Java
package com.thoughtworks.xstream.io;
|
|
|
|
import com.thoughtworks.xstream.io.naming.NameCoder;
|
|
import com.thoughtworks.xstream.io.naming.NoNameCoder;
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.FileNotFoundException;
|
|
import java.io.IOException;
|
|
import java.net.URL;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class AbstractDriver implements HierarchicalStreamDriver {
|
|
private NameCoder replacer;
|
|
|
|
public AbstractDriver() {
|
|
this(new NoNameCoder());
|
|
}
|
|
|
|
@Override // com.thoughtworks.xstream.io.HierarchicalStreamDriver
|
|
public HierarchicalStreamReader createReader(URL url) {
|
|
try {
|
|
return createReader(url.openStream());
|
|
} catch (IOException e) {
|
|
throw new StreamException(e);
|
|
}
|
|
}
|
|
|
|
protected NameCoder getNameCoder() {
|
|
return this.replacer;
|
|
}
|
|
|
|
public AbstractDriver(NameCoder nameCoder) {
|
|
this.replacer = nameCoder;
|
|
}
|
|
|
|
@Override // com.thoughtworks.xstream.io.HierarchicalStreamDriver
|
|
public HierarchicalStreamReader createReader(File file) {
|
|
try {
|
|
return createReader(new FileInputStream(file));
|
|
} catch (FileNotFoundException e) {
|
|
throw new StreamException(e);
|
|
}
|
|
}
|
|
}
|