Examples of markSupported()


Examples of java.io.InputStream.markSupported()

    public void testMarkAndReset() throws Exception {
        int position = 0;
        int readlimit = 10;
        InputStream input = new TestNullInputStream(100, true, false);
       
        assertTrue("Mark Should be Supported", input.markSupported());

        // No Mark
        try {
            input.reset();
            fail("Read limit exceeded, expected IOException ");

Examples of java.io.InputStream.markSupported()

    /**
     * Test <code>mark()</code> not supported.
     */
    public void testMarkNotSupported() throws Exception {
        InputStream input = new TestNullInputStream(100, false, true);
        assertFalse("Mark Should NOT be Supported", input.markSupported());

        try {
            input.mark(5);
            fail("mark() should throw UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {

Examples of java.io.InputStream.markSupported()

    }

    public void testMarkResetAfterReadWithoutBOM() throws Exception {
        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
        InputStream in = new BOMInputStream(createDataStream(data, false));
        assertTrue(in.markSupported());

        in.read();
        in.mark(10);

        in.read();

Examples of java.io.InputStream.markSupported()

    }

    public void testMarkResetAfterReadWithBOM() throws Exception {
        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
        InputStream in = new BOMInputStream(createDataStream(data, true));
        assertTrue(in.markSupported());

        in.read();
        in.mark(10);

        in.read();

Examples of java.io.InputStream.markSupported()

    }

    public void testMarkResetBeforeReadWithoutBOM() throws Exception {
        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
        InputStream in = new BOMInputStream(createDataStream(data, false));
        assertTrue(in.markSupported());

        in.mark(10);

        in.read();
        in.read();

Examples of java.io.InputStream.markSupported()

    }

    public void testMarkResetBeforeReadWithBOM() throws Exception {
        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
        InputStream in = new BOMInputStream(createDataStream(data, true));
        assertTrue(in.markSupported());

        in.mark(10);

        in.read();
        in.read();

Examples of java.io.InputStream.markSupported()

        InputStream in = record.getStream();
        try {
            // test whether mark and reset works
            assertTrue(in instanceof DbInputStream);
            in = new BufferedInputStream(in);
            assertTrue(in.markSupported());
            in.mark(data.length);
            while (-1 != in.read()) {
                // loop
            }
            assertTrue(in.markSupported());

Examples of java.io.InputStream.markSupported()

            assertTrue(in.markSupported());
            in.mark(data.length);
            while (-1 != in.read()) {
                // loop
            }
            assertTrue(in.markSupported());
            try {
                in.reset();
            } catch (Exception e) {
                fail("Unexpected exception while resetting input stream: " + e.getMessage());
            }

Examples of java.io.InputStream.markSupported()

            log.warn("No content length specified for stream data.  " +
                     "Stream contents will be buffered in memory and could result in " +
                     "out of memory errors.");
        }

        if (!input.markSupported()) {
            input = new RepeatableInputStream(input, Constants.DEFAULT_STREAM_BUFFER_SIZE);
        }

        if (metadata.getContentMD5() == null) {
            /*
 

Examples of java.io.InputStream.markSupported()

  @Test
  public void testMarkSupported() throws IOException
  {
    InputStream data = new ByteArrayInputStream(DATA);
    InputStream in = new LimitInputStream(data, 10);
    assertEquals(data.markSupported(), in.markSupported());
  }

  @Test
  public void testMarkAndReset() throws IOException
  {
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.