MyByteArrayOutputStream
包含多个文档的数据(因此超过 1 EOF
)。当我尝试使用 发送输出BufferedOutputStream
时,它只传递最后一个文档的数据(可能是因为它覆盖了除最后一个之外的所有其他文档)。
有什么方法可以跳过除最后一个之外的所有 EOF 并将其传递给BuffererdOutputStream
?
Java 代码如下:
private void outputBinaryTable(IRecordSet table, BufferedOutputStream output) throws ConnectorException, IOException
{
IRecordMetaData fields = table.retrieveMetaData();
int columnCount = fields.getColumnCount();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
//Utils.write("Table " + tableName + " has " + columnCount + " columns.");
loc.errorT("Table Name " + table + " has " + columnCount + " columns.");
if (table.first()){
do // For each row
{
for (int k = 0; k < columnCount; k++)
{
// Get the data as a byte array
byte [] data = table.getBytes(k);
outputStream.write(data);
//Utils.write(new String(data));
// Write the bytes to the output stream
//output.write(data);
}
}
while (table.next());
byte [] combineData = outputStream.toByteArray();
output.write(combineData);
}
}