📄 blobimpl.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 + -