1

ファイルに書き込んで読み取るのではなく、ストリームに書き込んですぐに使用したい。ファイルはスレッドセーフではなく、パフォーマンスに影響を与える可能性があると思います。

    //set property to an existing file
    prop.setProperty("$quoteValidity",""no");
    prop.setProperty("$date", "today");
    prop.setProperty("$quantitySum",  Integer.toString(quantitySum));

    //store it in temporary location
    prop.store(new FileOutputStream("<Temp file location>"), null);

    //open that temp file as stream
    InputStream propfile = new FileInputStream("<Temp file location>");

    List<Order> orderList = XmlToList.makeOrderFromNodeList(orderNode);
    //use that temp file
    Testground.generateXlsx(propfile,orderList);
4

1 に答える 1

1

FileOuputStream の代わりに ByteArrayOutputStream を使用してみてください。その後、呼び出すことができます

 byte[] bytes=byteArrayOutputStream.toByteArray() 

ByteArrayOutputStream でバイトを取得します

次に、ByteArrayInputStream(bytes) を構築し、それを Testground に渡します

于 2012-06-27T14:11:21.467 に答える