Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将excel单元格内容作为Java InputStream读取_Java_Excel_Inputstream - Fatal编程技术网

将excel单元格内容作为Java InputStream读取

将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

此代码将excel文件单元格的内容读入字符串

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?