⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blobimpl.java

📁  EasyDBO是一个超轻量级对象-关系映射(Object/Relation Mapping
💻 JAVA
字号:
/**
 * 
 */
package com.easyjf.dbo;


import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Blob;
import java.sql.SQLException;
/**
 * @author wangliang138840
 *
 */
public class BlobImpl implements Blob{
	
	private byte[] streamByte = null;
	private InputStream stream = null;
	private int length;
	
	public BlobImpl(InputStream stream, int length){
		this.stream  = stream;
		this.length = length;
	}
	
	public BlobImpl(byte[] streamByte){
		this.streamByte = streamByte;
		stream = new ByteArrayInputStream(streamByte);
		this.length = streamByte.length;
	}
	
    public long length()
    throws SQLException{
    	return length;
    }

	public void truncate(long l)
	    throws SQLException{
		
	}
	
	public byte[] getBytes(long l, int i)
	    throws SQLException{
		byte[] temp = new byte[i];

		System.arraycopy(streamByte, (int)(l - 1), temp, 0, i);
		return temp;
	}
	
	public int setBytes(long l, byte abyte0[])
	    throws SQLException{
		return -1;
	}
	
	public int setBytes(long l, byte abyte0[], int i, int j)
	    throws SQLException{
		return -1;
	}
	
	public long position(byte abyte0[], long l)
	    throws SQLException{
		return -1;
	}
	
	public InputStream getBinaryStream()
	    throws SQLException{
		return stream;
	}
	
	public OutputStream setBinaryStream(long l)
	    throws SQLException{
		return null;
	}
	
	public  long position(Blob blob, long l)
	    throws SQLException{
		return -1;
	}
}

⌨️ 快捷键说明

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