cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Ellis (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CASSANDRA-2250) BufferedRandomAccessFile.read(byte[], int, int) method reads max DEFAULT_BUFFER_SIZE
Date Fri, 25 Feb 2011 19:18:21 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-2250?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12999482#comment-12999482
] 

Jonathan Ellis commented on CASSANDRA-2250:
-------------------------------------------

I don't see a point in introducing non-standard differences in the contract BRAF provides
vs RAF.

Again, use readFully (the DataInput api) if you want that behavior.  read is deliberately
not defined that way.

> BufferedRandomAccessFile.read(byte[], int, int) method reads max DEFAULT_BUFFER_SIZE
> ------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2250
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2250
>             Project: Cassandra
>          Issue Type: Sub-task
>          Components: Core
>            Reporter: Pavel Yaskevich
>
> Test to reproduce:
> {code}
> File tempFile = File.createTempFile("braf", null);
> tempFile.deleteOnExit();
> BufferedRandomAccessFile file = new BufferedRandomAccessFile(tempFile, "rw");
> byte[] bigData = new byte[BufferedRandomAccessFile.DEFAULT_BUFFER_SIZE + 10];
> for (int i = 0; i < bigData.length; i++)
>      bigData[i] = 'd';
> long initialPosition = file.getFilePointer();
> file.write(bigData); // writing data
> assert file.getFilePointer() == initialPosition + bigData.length;
> assert file.length() == initialPosition + bigData.length; // file size should equals
to last position
> // reading written buffer
> file.seek(initialPosition);
> data = new byte[bigData.length];
> assert file.read(data) == data.length; <-- Fails (returns DEFAULT_BUFFER_SIZE as file.read(..)
result)
> {code}
>  

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message