Package java.io

Examples of java.io.InputStream.reset()


                // use a buffered input stream to find out whether there actually
                // is a request body
                InputStream bin = new BufferedInputStream(in);
                bin.mark(1);
                boolean isEmpty = -1 == bin.read();
                bin.reset();
                if (!isEmpty) {
                    requestDocument = DomUtil.parseDocument(bin);
                }
            }
        } catch (IOException e) {
View Full Code Here


      if (read != pblen) throw new IOException("read=" + read + ", wanted=" + pblen);
      // WATCHOUT! Return in middle of function!!!
      if (ProtobufUtil.isPBMagicPrefix(pbuf)) return convert(FSProtos.Reference.parseFrom(in));
      // Else presume Writables.  Need to reset the stream since it didn't start w/ pb.
      // We won't bother rewriting thie Reference as a pb since Reference is transitory.
      in.reset();
      Reference r = new Reference();
      DataInputStream dis = new DataInputStream(in);
      // Set in = dis so it gets the close below in the finally on our way out.
      in = dis;
      r.readFields(dis);
View Full Code Here

                        return new InstallResult(true, b, 0);
                    }
                }
            }
            try {
                is.reset();
            } catch (IOException e) {
                is.close();
                is = new BufferedInputStream(new URL(bundleLocation).openStream());
            }
            LOGGER.debug("Installing bundle " + bundleLocation);
View Full Code Here

                        bout.write(b);
                    }
                } catch (IOException ignored) {
                }
                try { bout.close();} catch (IOException ignored) {}
                try { inp.reset();} catch (IOException ignored) {}
                ret = new SAXSource(new InputSource(new ByteArrayInputStream(bout.toByteArray())));
            } else if(ssrc.getInputSource().getCharacterStream() != null) {
                Reader rdr = ssrc.getInputSource().getCharacterStream();
                CharArrayWriter caw = new CharArrayWriter();
                try {
View Full Code Here

                        bout.write(b);
                    }
                } catch (IOException ignored) {
                }
                try { bout.close();} catch (IOException ignored) {}
                try { inp.reset();} catch (IOException ignored) {}
                ret = new StreamSource(new ByteArrayInputStream(bout.toByteArray()));
            } else if(ssrc.getReader() != null) {
                Reader rdr = ssrc.getReader();
                CharArrayWriter caw = new CharArrayWriter();
                try {
View Full Code Here

                        bout.write(b);
                    }
                } catch (IOException ignored) {
                }
                try { bout.close();} catch (IOException ignored) {}
                try { inp.reset();} catch (IOException ignored) {}
                ret = new SAXSource(new InputSource(new ByteArrayInputStream(bout.toByteArray())));
            } else if(ssrc.getInputSource().getCharacterStream() != null) {
                Reader rdr = ssrc.getInputSource().getCharacterStream();
                CharArrayWriter caw = new CharArrayWriter();
                try {
View Full Code Here

                        bout.write(b);
                    }
                } catch (IOException ignored) {
                }
                try { bout.close();} catch (IOException ignored) {}
                try { inp.reset();} catch (IOException ignored) {}
                ret = new StreamSource(new ByteArrayInputStream(bout.toByteArray()));
            } else if(ssrc.getReader() != null) {
                Reader rdr = ssrc.getReader();
                CharArrayWriter caw = new CharArrayWriter();
                try {
View Full Code Here

        throws SQLException {
    InputStream blobInput = new ByteArrayInputStream(blobData, 0, blobData.length);
        PreparedStatement pStmt =
            con.prepareStatement("update BLOBCLOB set BLOBDATA = ? where ID = ?");
        try {
            blobInput.reset();
        } catch (IOException ioe) {
            fail("Failed to reset blob input stream: " + ioe.getMessage());
        }
        pStmt.setBlob(1, blobInput, blobData.length);
        pStmt.setInt(2, ID_SAMPLEVALUES);
View Full Code Here

                        in.close();
                        modifyZipEntry(out_entry, bytes, crc32);
                        in = new ByteArrayInputStream(bytes);
                    } else {
                        // the classfile has not been enhanced
                        in.reset();
                    }
                }

                // copy the entry
                zip_out.putNextEntry(out_entry);
View Full Code Here

        if (sh1 == 128 && sh2 == 1) {
            //Found the first section header of a PFB file!
            throw new IOException("Cannot parse PFM file. You probably specified the PFB file"
                    + " of a Type 1 font as parameter instead of the PFM.");
        }
        bufin.reset();
        byte[] b = new byte[16];
        bufin.read(b);
        if (new String(b, "US-ASCII").equalsIgnoreCase("StartFontMetrics")) {
            //Found the header of a AFM file!
            throw new IOException("Cannot parse PFM file. You probably specified the AFM file"
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.