Package java.io

Examples of java.io.ByteArrayInputStream.reset()


            // check for DHCP MAGIC_COOKIE
            this.isDhcp = true;
            inBStream.mark(4);        // read ahead 4 bytes
            if (inStream.readInt() != _MAGIC_COOKIE) {
                this.isDhcp = false;
                inBStream.reset();    // re-read the 4 bytes
            }

            if (this.isDhcp) {    // is it a full DHCP packet or a simple BOOTP?
                // DHCP Packet: parsing options
                int type = 0;
View Full Code Here


        ByteArrayInputStream input = new ByteArrayInputStream("test".getBytes());
        responseCode = put(m_host, "repository/commit", "apache", "test", "1", input);
        assertResponseCode(HttpURLConnection.HTTP_INTERNAL_ERROR, responseCode);

        input.reset();
        responseCode = put(m_host, "repository/commit", "apache", "test", "0", input);
        assertResponseCode(HttpURLConnection.HTTP_OK, responseCode);

        out.reset();
        responseCode = get(m_host, "repository/checkout", "apache", "test", "1", out);
View Full Code Here

        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream("test".getBytes());

        int responseCode = put(m_host, "replication/put", "apache", "test", "1", byteArrayInputStream);
        assertResponseCode(HttpURLConnection.HTTP_OK, responseCode);

        byteArrayInputStream.reset();

        responseCode = put(m_host, "repository/commit", "apache", "test", "0", byteArrayInputStream);
        assertResponseCode(HttpURLConnection.HTTP_INTERNAL_ERROR, responseCode);

        removeRepository("testInstance");
View Full Code Here

                    .getInputStream(manifestEntry);
            if (verifier != null) {
                byte[] buf = new byte[is.available()];
                is.mark(buf.length);
                is.read(buf, 0, buf.length);
                is.reset();
                verifier.addMetaEntry(manifestEntry.getName(), buf);
            }
            try {
                manifest = new Manifest(is, verifier != null);
            } finally {
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

        } catch (IOException e) {
            errln("Failed: Lenient authenticate object should pass ICUBinary.readHeader");
        }
        // no restriction to the data version
        try {
            inputstream.reset();
            ICUBinary.readHeader(inputstream, formatid, null);
        } catch (IOException e) {
            errln("Failed: Null authenticate object should pass ICUBinary.readHeader");
        }
        // lenient data version
View Full Code Here

        } catch (IOException e) {
            errln("Failed: Null authenticate object should pass ICUBinary.readHeader");
        }
        // lenient data version
        try {
            inputstream.reset();
            ICUBinary.readHeader(inputstream, formatid, authenticate);
        } catch (IOException e) {
            errln("Failed: Lenient authenticate object should pass ICUBinary.readHeader");
        }
        // changing the version to an incorrect one, expecting failure
View Full Code Here

            errln("Failed: Lenient authenticate object should pass ICUBinary.readHeader");
        }
        // changing the version to an incorrect one, expecting failure
        array[16] = 2;
        try {
            inputstream.reset();
            ICUBinary.readHeader(inputstream, formatid, authenticate);
            errln("Failed: Invalid version number should not pass authenticate object");
        } catch (IOException e) {
            logln("PASS: ICUBinary.readHeader with invalid version number failed as expected");
        }
View Full Code Here

      catch (Exception e) {
        log.error("Exception during repository metadata cleansing.", e);

        if (backup != null) {
          // get backup and continue operation
          backup.reset();
          mdFile.setContentLocator(new ByteArrayContentLocator(backup1.toByteArray(), mdFile.getMimeType()));
        }
      }
    }
View Full Code Here

                setEntityInputStream(in);
            }

            ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream) in;
            Form f = getEntity(Form.class);
            byteArrayInputStream.reset();
            return f;
        } else {
            return new Form();
        }
    }
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.