clobimpl.java

来自「羽量级数据持久层开发框架」· Java 代码 · 共 232 行

JAVA
232
字号
package org.speedframework.entity;

//~--- JDK imports ------------------------------------------------------------

import java.io.*;

import java.sql.Clob;
import java.sql.SQLException;

/**
 * Clob ???????
 *
 * @author lizf
 */
public class ClobImpl implements Clob
 {

    /** 属性描述信息 */
    private boolean needsReset = false;

    /** 属性描述信息 */
    private int length;

    /** 属性描述信息 */
    private Reader reader;

    /**
     * Constructs ...
     *
     *
     * @param string
     */
    public ClobImpl(String string) {
        reader = new StringReader(string);
        length = string.length();
    }

    /**
     * Constructs ...
     *
     *
     * @param reader
     * @param length
     */
    public ClobImpl(Reader reader, int length) {
        this.reader = reader;
        this.length = length;
    }

    /**
     * 方法描述信息,
     * 描述方法是做什么的,
     * 如何调用,最好给出调用代码示例。
     *
     * @return
     *
     * @throws SQLException
     */
    public long length() throws SQLException {
        return length;
    }

    /**
     * 方法描述信息,
     * 描述方法是做什么的,
     * 如何调用,最好给出调用代码示例。
     *
     * @param len
     *
     * @throws SQLException
     */
    public void truncate(long len) throws SQLException {}

    /**
     * 方法描述信息,
     * 描述方法是做什么的,
     * 如何调用,最好给出调用代码示例。
     *
     * @return
     *
     * @throws SQLException
     */
    public InputStream getAsciiStream() throws SQLException {
        try {
            if (needsReset) {
                reader.reset();
            }
        } catch (IOException ioe) {
            throw new SQLException("could not reset reader");
        }

        needsReset = true;

        return new ByteArrayInputStream(reader.toString().getBytes());
    }

    /**
     * 方法描述信息,
     * 描述方法是做什么的,
     * 如何调用,最好给出调用代码示例。
     *
     * @param pos
     *
     * @return
     *
     * @throws SQLException
     */
    public OutputStream setAsciiStream(long pos) throws SQLException {
        return null;
    }

    /**
     * 方法描述信息,
     * 描述方法是做什么的,
     * 如何调用,最好给出调用代码示例。
     *
     * @return
     *
     * @throws SQLException
     */
    public Reader getCharacterStream() throws SQLException {
        try {
            if (needsReset) {
                reader.reset();
            }
        } catch (IOException ioe) {
            throw new SQLException("could not reset reader");
        }

        needsReset = true;

        return reader;
    }

    /**
     * 方法描述信息,
     * 描述方法是做什么的,
     * 如何调用,最好给出调用代码示例。
     *
     * @param pos
     *
     * @return
     *
     * @throws SQLException
     */
    public Writer setCharacterStream(long pos) throws SQLException {
        return null;
    }

    /**
     * 方法描述信息,
     * 描述方法是做什么的,
     * 如何调用,最好给出调用代码示例。
     *
     * @param pos
     * @param length
     *
     * @return
     *
     * @throws SQLException
     */
    public String getSubString(long pos, int length) throws SQLException {
        return null;
    }

    /**
     * 方法描述信息,
     * 描述方法是做什么的,
     * 如何调用,最好给出调用代码示例。
     *
     * @param pos
     * @param str
     *
     * @return
     *
     * @throws SQLException
     */
    public int setString(long pos, String str) throws SQLException {
        return 0;
    }

    /**
     * 方法描述信息,
     * 描述方法是做什么的,
     * 如何调用,最好给出调用代码示例。
     *
     * @param pos
     * @param str
     * @param offset
     * @param len
     *
     * @return
     *
     * @throws SQLException
     */
    public int setString(long pos, String str, int offset, int len) throws SQLException {
        return 0;
    }

    /**
     * 方法描述信息,
     * 描述方法是做什么的,
     * 如何调用,最好给出调用代码示例。
     *
     * @param searchstr
     * @param start
     *
     * @return
     *
     * @throws SQLException
     */
    public long position(String searchstr, long start) throws SQLException {
        return 0;
    }

    /**
     * 方法描述信息,
     * 描述方法是做什么的,
     * 如何调用,最好给出调用代码示例。
     *
     * @param searchstr
     * @param start
     *
     * @return
     *
     * @throws SQLException
     */
    public long position(Clob searchstr, long start) throws SQLException {
        return 0;
    }
}

⌨️ 快捷键说明

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