I am using the MultipartParser servlet code and if the form data is a file
then a new FilePart object is created.  The InputStream is passed along to
the constructor.  I try to create a new object but it always uses the same
InputStream.  When the read or skip is done it affects the one and only
inputstream.

So - I'm not actually opening a file - the data is coming from a web form.


----- Original Message -----
From: "Margaret Fisk" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 14, 2001 4:52 PM
Subject: Re: Image Information Using MultipartParser


> Couldn't you open the same file twice, once to read your preview and once
to
> write the file? Or does this then become a resource issue?
>
> -----Original Message-----
> From: John Nelson [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 14, 2001 2:01 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Image Information Using MultipartParser
>
>
> That would work - however ideally I'd want to skip the first six bytes and
> read in the next two.  And in some cases I `may not know how many bytes I
> need to skip - in the case of a jpeg I need to read in lots of data or
skip
> lots of data.
>
> So I guess the real issue is - how can I mess around with the
> ServletInputStream data and then then reset the pointer back to the
> beginning of the stream.
>
> Thanks
>
> ----- Original Message -----
> From: "Penner Matt" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, June 14, 2001 4:46 PM
> Subject: Re: Image Information Using MultipartParser
>
>
> > When you read in the first 8 bytes save them in a byte[] array.  Then
when
> you
> > start to write to the file use the write(byte[]) method of the
FileWriter
> class
> > or whatever you are using.  After that just procede to write the rest of
> the
> > file.
> >
> > That should do it.
> >
> > Matt
> >
> >
> > Quoting John Nelson <[EMAIL PROTECTED]>:
> >
> > > I have successfully implemented the MultipartParser servlet and I have
> > > access to all of the form data.  When I get a FilePart I want to read
> > > some
> > > of the contents of the raw data.  Ideally I want to read 2 bytes of
> > > data
> > > starting at the 6th byte (the is the value of the width in a .gif
> > > file).
> > > The problem I'm having is that once I read the data the pointer into
> > > the
> > > ServletInputStream is on the 8th byte and when the file is written to
> > > disk I
> > > lose the first 8 bytes.  I cannot seem to use the mark() and reset()
> > > methods
> > > of an InputStream - it doesn't work.
> > >
> > > Has anyone successfully read the raw data from a FilePart and still
> > > written
> > > the file to disk?
> > >
> > > Thanks
> > >
> > >
> > > -John Nelson
> > >
> > >
>
___________________________________________________________________________
> > > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> > > body
> > > of the message "signoff SERVLET-INTEREST".
> > >
> > > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > > Resources:
http://java.sun.com/products/servlet/external-resources.html
> > > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> > >
> >
> >
>
___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to