harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Markov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-4177) [classlib][io] Unnecessary data copying in BufferedOutputStream.write() method
Date Fri, 15 Jun 2007 14:28:28 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-4177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505252
] 

Mikhail Markov commented on HARMONY-4177:
-----------------------------------------

The API specification stays that "If the requested length is at least as large as this stream's
buffer, however, then this method will flush the buffer and write the bytes directly to the
underlying output stream." - but the described test is not this case (although this situation
also does not work properly on Harmony).

The spec says that "Ordinarily this method stores bytes from the given array into this stream's
buffer, flushing the buffer to the underlying output stream as needed." - this statement could
be treated depending on implementation if free buffer space less aht data to write: RI first
flush the buffer and then fill it again, Harmony fill the buffer till the end and then fill
the buffer. Both implementations are correct, nevertheless i think it's easier to follow RI
here that to argue why we should not do this :-). I'll provide the patch soon.


> [classlib][io] Unnecessary data copying in BufferedOutputStream.write() method 
> -------------------------------------------------------------------------------
>
>                 Key: HARMONY-4177
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4177
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Roman S. Bushmanov
>         Attachments: Test.java
>
>
> According to specification, if the data to write is longer than the free buffer space
than the buffer should be flushed first to avoid unnecessary data copying.
> Harmony behaves differently. The buffer contents is written to underlying output stream
only when it is full.
> To reproduce the issue, please run the attached testcase.
> The expected output is  "ab" while harmony prints "abc".
> Affected test: 
> functional/org/apache/harmony/test/func/api/java/io/BufferedOutputStream/BufferedOutputStreamTest.xml
> (see HARMONY-3528) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message