org.redkale.convert.ext.FileSimpledCoder Maven / Gradle / Ivy
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.convert.ext;
import java.io.File;
import org.redkale.convert.*;
/**
* 文件 的SimpledCoder实现
*
*
* 详情见: https://redkale.org
*
* @author zhangjx
* @param Reader输入的子类型
* @param Writer输出的子类型
*/
public class FileSimpledCoder extends SimpledCoder {
public static final PatternSimpledCoder instance = new PatternSimpledCoder();
@Override
public void convertTo(W out, File value) {
if (value == null) {
out.writeNull();
} else {
out.writeString(value.getPath());
}
}
@Override
public File convertFrom(R in) {
String value = in.readString();
if (value == null) return null;
return new File(value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy