Message from discussion
How to monitor upload progress?
X-BeenThere: google-documents-list-api@googlegroups.com
Received: by 10.101.154.37 with SMTP id g37ls3203157ano.3.p; Tue, 15 Dec 2009
02:01:09 -0800 (PST)
Received: by 10.101.183.21 with SMTP id k21mr6887015anp.22.1260871269568;
Tue, 15 Dec 2009 02:01:09 -0800 (PST)
Received: by 10.101.183.21 with SMTP id k21mr6887014anp.22.1260871269525;
Tue, 15 Dec 2009 02:01:09 -0800 (PST)
Return-Path: <bobbysoa...@gmail.com>
Received: from mail-gx0-f198.google.com (mail-gx0-f198.google.com [209.85.217.198])
by gmr-mx.google.com with ESMTP id 24si638151yxe.15.2009.12.15.02.01.09;
Tue, 15 Dec 2009 02:01:09 -0800 (PST)
Received-SPF: pass (google.com: domain of bobbysoa...@gmail.com designates 209.85.217.198 as permitted sender) client-ip=209.85.217.198;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of bobbysoa...@gmail.com designates 209.85.217.198 as permitted sender) smtp.mail=bobbysoa...@gmail.com
Received: by mail-gx0-f198.google.com with SMTP id 22so10156919gxk.17
for <google-documents-list-api@googlegroups.com>; Tue, 15 Dec 2009 02:01:09 -0800 (PST)
MIME-Version: 1.0
Received: by 10.150.168.5 with SMTP id q5mr308706ybe.82.1260871269486; Tue, 15
Dec 2009 02:01:09 -0800 (PST)
Date: Tue, 15 Dec 2009 02:01:09 -0800 (PST)
In-Reply-To: <67819ca00912141810g42c8e8f9k69e8c972cbf78361@mail.gmail.com>
X-IP: 75.130.89.102
References: <2f20fcce-cc8c-44a2-a719-15c7f52fdea9@m16g2000yqc.googlegroups.com>
<61532.51418.qm@web65601.mail.ac4.yahoo.com> <67819ca00912141810g42c8e8f9k69e8c972cbf78361@mail.gmail.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.0.15)
Gecko/2009101601 Firefox/3.0.15,gzip(gfe),gzip(gfe)
Message-ID: <cf6756eb-ab9e-45a2-9027-b4c1292a63bd@j14g2000yqm.googlegroups.com>
Subject: Re: How to monitor upload progress?
From: Bobby <bobbysoa...@gmail.com>
To: Google Documents List API <google-documents-list-api@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
I think you may be able to implement this by using the
MediaStreamSource class for uploading document contents:
http://code.google.com/apis/gdata/javadoc/com/google/gdata/data/media/Media=
StreamSource.html
The constructor for MediaStreamSource takes in an InputStream so for
example, suppose you create a class, MonitoredInputStream, that
extends InputStream and overrides the read methods to keep track of
how many bytes have been read, then, since it's unlikely that the
GData library reads the whole stream into memory (and rather just
keeps a small buffer) this should give you a good idea of how many
bytes have been uploaded, which you can make available to your
progress bar control.
I haven't implemented this, but it sounds like it would work.
Bobby
On Dec 14, 9:10=A0pm, abe oppenheim <abe.oppenh...@gmail.com> wrote:
> well, i want to monitor the progress of a document upload from my java co=
de.
> =A0so that i could do things like display a progress dialog. or cancel an
> upload.
>
> On Mon, Dec 14, 2009 at 9:09 PM, brian karlo gutierrez
> <brikz...@yahoo.com>wrote:
>
> > General monitoring of network connections, better use wireshark. That
> > really helps me a lot in determining if I really send the correct http
> > request to the google server.
>
> > - Brian
>
> > --- On *Tue, 12/15/09, javadev <abe.oppenh...@gmail.com>* wrote:
>
> > From: javadev <abe.oppenheim@gmail..com>
> > Subject: [Google Documents List API] How to monitor upload progress?
> > To: "Google Documents List API" <
> > google-documents-list-api@googlegroups.com>
> > Date: Tuesday, December 15, 2009, 6:18 AM
>
> > I am using this java code to upload files:
>
> > String destFolderStr =3D "http://docs.google.com/feeds/default/private/
> > full/";
> > String mimeType =3D DocumentListEntry.MediaType.fromFileName(file.getNa=
me
> > ()).getMimeType();
>
> > DocumentListEntry newDocument =3D new DocumentListEntry();
> > newDocument.setFile(new File(file.getPath()), mimeType);
> > newDocument.setTitle(new PlainTextConstruct(file.getName()));
>
> > DocumentListEntry newEntry =3D (DocumentListEntry) m_Service.insert(new
> > URL(destFolderStr), newDocument);
>
> > Is there any way that I can monitor the reading of the byte stream
> > such that I can monitor the progress of the upload? =A0I assume this
> > would require extending and re-implementing the "insert" method from
> > the gdata library? =A0Any chance some sort of example for doing is this
> > is available?
>
> > Thank You