0

このコードは、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)
        {
        }
    }
4

1 に答える 1

1

いつでも文字列を ByteArrayInputStream にラップして、関数に渡すことができます。

encrypt(new ByteArrayInputStream(theCell_00.getBytes()), outputStream)
于 2009-11-21T06:53:49.803 に答える