Return-Path: X-Original-To: apmail-hadoop-hdfs-dev-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 92BA29C70 for ; Thu, 3 May 2012 16:21:14 +0000 (UTC) Received: (qmail 11068 invoked by uid 500); 3 May 2012 16:21:14 -0000 Delivered-To: apmail-hadoop-hdfs-dev-archive@hadoop.apache.org Received: (qmail 10995 invoked by uid 500); 3 May 2012 16:21:14 -0000 Mailing-List: contact hdfs-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-dev@hadoop.apache.org Delivered-To: mailing list hdfs-dev@hadoop.apache.org Received: (qmail 10987 invoked by uid 99); 3 May 2012 16:21:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 May 2012 16:21:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 May 2012 16:21:11 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 89F6B42E494 for ; Thu, 3 May 2012 16:20:50 +0000 (UTC) Date: Thu, 3 May 2012 16:20:50 +0000 (UTC) From: "Suresh Srinivas (JIRA)" To: hdfs-dev@hadoop.apache.org Message-ID: <735759077.22424.1336062050581.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <2021413872.22074.1336057130283.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Reopened] (HDFS-3361) read(long position, byte[] buffer, int offset, int length) is not behaving as expected MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-3361?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Suresh Srinivas reopened HDFS-3361: ----------------------------------- > read(long position, byte[] buffer, int offset, int length) is not behaving as expected > --------------------------------------------------------------------------------------- > > Key: HDFS-3361 > URL: https://issues.apache.org/jira/browse/HDFS-3361 > Project: Hadoop HDFS > Issue Type: Bug > Components: hdfs client > Affects Versions: 2.0.0, 3.0.0 > Reporter: Brahma Reddy Battula > Fix For: 2.0.0 > > > Start NN and DN > write a file with size 1024 > now try to read file using following api > fsin.read(writeBuff, 1024, fsin.available())..This is retuning correctly as expected. > fsin.read(10, writeBuff, 10, fsin.available())(this is retunring zero.) > Here it's returning zero..But actual file length is 1024 > > *Java Docs provided* > {code} > /** > * Read bytes from the given position in the stream to the given buffer. > * > * @param position position in the input stream to seek > * @param buffer buffer into which data is read > * @param offset offset into the buffer in which data is written > * @param length maximum number of bytes to read > * @return total number of bytes read into the buffer, or -1 > * if there is no more data because the end of the stream has been > * reached > */ > public int read(long position, byte[] buffer, int offset, int length) > throws IOException { > return ((PositionedReadable)in).read(position, buffer, offset, length); > } > {code} > But If I try with only ->fsin.read(10, writeBuff, 10, fsin.available())(client prog contains only one read method) > I am getting actual length...I am not sure actual cause.. > Please correct me If I am wrong......... -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira