print.java
来自「java 的源代码」· Java 代码 · 共 53 行
JAVA
53 行
package com.reddragon2046.base.utilities.data.functions;
import com.reddragon2046.base.utilities.data.UnaryFunction;
import java.io.*;
public final class Print
implements UnaryFunction
{
public Print()
{
stream = System.out;
}
public Print(PrintStream stream)
{
this.stream = stream;
}
public Object execute(Object object)
{
stream.println(object);
return object;
}
private void writeObject(ObjectOutputStream stream)
throws IOException
{
stream.defaultWriteObject();
if(this.stream == System.out)
stream.writeObject(new Boolean(true));
else
if(this.stream == System.err)
stream.writeObject(new Boolean(false));
else
stream.writeObject(this.stream);
}
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException
{
stream.defaultReadObject();
Object obj = stream.readObject();
if(obj instanceof Boolean)
this.stream = ((Boolean)obj).booleanValue() ? System.out : System.err;
else
this.stream = (PrintStream)obj;
}
transient PrintStream stream;
static final long serialVersionUID = 0xaef29737514f92a5L;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?