Please get newest jdbc driver at: http://jdbc.fastcrypt.com > Your name : Hatanaka, Akihiro > Your email address : [EMAIL PROTECTED] > > > System Configuration > --------------------- > Architecture (example: Intel Pentium) : Intel Pentium > > Operating System (example: Linux 2.0.26 ELF) : Debian Linux > > PostgreSQL version (example: PostgreSQL-7.1.1): PostgreSQL-7.1.2 > > Compiler used (example: gcc 2.95.2) : gcc egcs-2.91.66 > jdk 1.3.1 > > > Please enter a FULL description of your problem: > ------------------------------------------------ > I developed an application in java. > I storeed the file that has "-1" in the first position, using the > Large Object Support function. > However, when I load that file from the database as the "InputStream" > class object, I was unable to read data until the file end. > That is because the "read()" method of the "InputStream" class returns "-1". > > > > Please describe a way to repeat the problem. Please try to provide a > concise reproducible example, if at all possible: > ---------------------------------------------------------------------- > Please, compile the attacked program and execute this. (for example : > java IOTest test)This program outputs the below. > > ================================================ > From DB 0:-1 > From DB 1:1 > From DB 2:2 > From File 0:255 > From File 1:1 > From File 2:2 > ================================================= > > However, I think this outputs would be the below. > > ================================================ > From DB 0:255 > From DB 1:1 > From DB 2:2 > From File 0:255 > From File 1:1 > From File 2:2 > ================================================= > > > > If you know how this problem might be fixed, list the solution below: > --------------------------------------------------------------------- > > "read()" method of "org.postgresql.largeobject.BlobInputStream" is > changed below, I think. > > ================================================= > public int read() throws java.io.IOException { > try { > if(buffer==null || bpos>=buffer.length) { > buffer=lo.read(bsize); > bpos=0; > } > > // Handle EOF > if(bpos>=buffer.length) > return -1; > > if(buffer[bpos]<-1){ > return (int) 256+buffer[bpos]; > }else{ > return (int) buffer[bpos]; > } > bpos++; > } catch(SQLException se) { > throw new IOException(se.toString()); > } > } > ================================================= [ Attachment, skipping... ] > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED] -- Bruce Momjian | http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026 ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster