Return-Path: X-Original-To: apmail-jmeter-dev-archive@minotaur.apache.org Delivered-To: apmail-jmeter-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 00BF710168 for ; Mon, 3 Jun 2013 19:43:19 +0000 (UTC) Received: (qmail 42110 invoked by uid 500); 3 Jun 2013 19:43:18 -0000 Delivered-To: apmail-jmeter-dev-archive@jmeter.apache.org Received: (qmail 42071 invoked by uid 500); 3 Jun 2013 19:43:18 -0000 Mailing-List: contact dev-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jmeter.apache.org Delivered-To: mailing list dev@jmeter.apache.org Received: (qmail 42063 invoked by uid 99); 3 Jun 2013 19:43:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jun 2013 19:43:18 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of philippe.mouawad@gmail.com designates 209.85.223.171 as permitted sender) Received: from [209.85.223.171] (HELO mail-ie0-f171.google.com) (209.85.223.171) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jun 2013 19:43:11 +0000 Received: by mail-ie0-f171.google.com with SMTP id s9so11766679iec.30 for ; Mon, 03 Jun 2013 12:42:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=CEQQSF1AiSGtx8R4RMe9w2GPG1bN+ik7cGJi/USpzq0=; b=qojsW+VtBTvaslJ/GtrVVFs+f+L+Z8YhMC5OcnqebGcosXw8guQiiG33u7jJPqwdSf 0zNfTOkiY2mXceaX/CZ8BKTZdLOd9g3e8Pz9t4viuF/XU76jERWoTZWD1bKv6ceeyDhG i3c386+3lVlenkPPmPkgAXHucPAqlDJbc8P1HxbxgoCVTsAWKl/crusAJNgwygp8zmjs D70PmyQqKoJ/8vulwvjOH6E9lYLqf7WYQ2GiuzbUS+YI8PFUaTXuLqBuu4moQv8v5df5 KN1AhChb9FLfvvZbHCyuw80+D8n5BwafHBRMDwd2PIHDuJnx+6TNcyciVtzWqOE5GAnl rLig== MIME-Version: 1.0 X-Received: by 10.50.128.44 with SMTP id nl12mr9137697igb.0.1370288570082; Mon, 03 Jun 2013 12:42:50 -0700 (PDT) Received: by 10.42.58.210 with HTTP; Mon, 3 Jun 2013 12:42:49 -0700 (PDT) In-Reply-To: References: <20130529200721.19172238889B@eris.apache.org> Date: Mon, 3 Jun 2013 21:42:49 +0200 Message-ID: Subject: Re: svn commit: r1487627 - /jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java From: Philippe Mouawad To: dev@jmeter.apache.org Content-Type: multipart/alternative; boundary=089e013a011c75a9a004de452ba7 X-Virus-Checked: Checked by ClamAV on apache.org --089e013a011c75a9a004de452ba7 Content-Type: text/plain; charset=ISO-8859-1 You are right, thanks Rollback done On Thu, May 30, 2013 at 1:15 AM, sebb wrote: > On 29 May 2013 21:07, wrote: > > Author: pmouawad > > Date: Wed May 29 20:07:20 2013 > > New Revision: 1487627 > > > > URL: http://svn.apache.org/r1487627 > > Log: > > Bug 54990 - Download large files avoiding outOfMemory > > Use method from commons-io > > Bugzilla Id: 54990 > > -1 > > That looks simpler, but requires an extra 4k buffer to be allocated. > Not ideal when the idea is to reduce memory overhead. > > > Modified: > > jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java > > > > Modified: > jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java > > URL: > http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java?rev=1487627&r1=1487626&r2=1487627&view=diff > > > ============================================================================== > > --- jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java > (original) > > +++ jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java > Wed May 29 20:07:20 2013 > > @@ -18,6 +18,7 @@ > > > > package org.apache.jorphan.util; > > > > +import java.io.ByteArrayInputStream; > > import java.io.Closeable; > > import java.io.IOException; > > import java.io.InputStream; > > @@ -29,6 +30,7 @@ import java.util.List; > > import java.util.Map; > > import java.util.StringTokenizer; > > > > +import org.apache.commons.io.IOUtils; > > import org.apache.commons.lang3.StringUtils; > > > > /** > > @@ -523,8 +525,6 @@ public final class JOrphanUtils { > > return StringUtils.isBlank(value); > > } > > > > - private static final int DEFAULT_CHUNK_SIZE = 4096; > > - > > /** > > * Write data to an output stream in chunks with a maximum size of > 4K. > > * This is to avoid OutOfMemory issues if the data buffer is very > large > > @@ -536,13 +536,6 @@ public final class JOrphanUtils { > > */ > > // Bugzilla 54990 > > public static void write(byte[] data, OutputStream output) throws > IOException { > > - int bytes = data.length; > > - int offset = 0; > > - while(bytes > 0) { > > - int chunk = Math.min(bytes, DEFAULT_CHUNK_SIZE); > > - output.write(data, offset, chunk); > > - bytes -= chunk; > > - offset += chunk; > > - } > > + IOUtils.copyLarge(new ByteArrayInputStream(data), output); > > } > > } > > \ No newline at end of file > > > > > -- Cordialement. Philippe Mouawad. --089e013a011c75a9a004de452ba7--