abstractsaver.java

来自「MacroWeka扩展了著名数据挖掘工具weka」· Java 代码 · 共 65 行

JAVA
65
字号
package chen.macroweka.core.converters;

import weka.core.Instances;

import java.io.File;
import java.io.IOException;
import java.io.OutputStream;

/**
 * Abstract class gives default implementation of setSource
 * methods. All other methods must be overridden.
 *
 */
public abstract class AbstractSaver implements Saver
{

    /**
     * Default implementation throws an IOException.
     *
     * @param file the File
     * @throws IOException always
     */
    public void setDestination(File file) throws IOException
    {
        throw new IOException( "Setting File as source not supported" );
    }

    /**
     * Default implementation throws an IOException.
     *
     * @param input the input stream
     * @throws IOException always
     */
    public void setDestination(OutputStream input) throws IOException
    {
        throw new IOException( "Setting InputStream as source not supported" );
    }

    public void beginSave()
    {
        // Empty implementation
    }

    public void endSave() throws IOException
    {
        // Empty implementation
    }

    /**
     * Saves the structure (internally the header) of the data set.
     *
     * @param instances the set of Instances
     * @throws IOException if there is no source or saving fails
     */
    public abstract void saveStructure(Instances instances) throws IOException;

    /**
     * Save the full data set.
     *
     * @param instances the full data set as an Instances object
     * @throws IOException if there is an error during saving
     */
    public abstract void saveDataSet(Instances instances) throws Exception;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?