将excel单元格内容作为Java InputStream读取
此代码将excel文件单元格的内容读入字符串将excel单元格内容作为Java InputStream读取,java,excel,inputstream,Java,Excel,Inputstream,此代码将excel文件单元格的内容读入字符串 String theCell_00=rs.getCell(j,i).getContents(); 是否有任何方法将excel单元格的内容读取为Java InputStream 我需要读取excel单元格内容并将内容传递给此函数的InputStream参数 public void encrypt(InputStream in, OutputStream out) { try { // B
String theCell_00=rs.getCell(j,i).getContents();
是否有任何方法将excel单元格的内容读取为Java InputStream
我需要读取excel单元格内容并将内容传递给此函数的InputStream参数
public void encrypt(InputStream in, OutputStream out)
{
try
{
// Bytes written to out will be encrypted
out = new CipherOutputStream(out, ecipher);
// Read in the cleartext bytes and write to out to encrypt
int numRead = 0;
while ((numRead = in.read(buf)) >= 0)
{
out.write(buf, 0, numRead);
}
out.close();
}
catch (java.io.IOException e)
{
}
}
您始终可以将字符串包装在ByteArrayInputStream中,并将其传递给函数:
encrypt(new ByteArrayInputStream(theCell_00.getBytes()), outputStream)
为什么?您使用的是哪种API?