Package java.io

Examples of java.io.Reader.markSupported()


  }
 
  @Test
  public void testMarkReset() throws IOException {
    Reader reader = new ReusableStringReader();
    if (reader.markSupported()) {
      ((ReusableStringReader)reader).set(fox);
      assertTrue(reader.ready());
     
      char[] cc = new char[6];
      int read;
View Full Code Here


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

        // No Mark
        try {
            reader.reset();
            fail("Read limit exceeded, expected IOException ");
View Full Code Here

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

        try {
            reader.mark(5);
            fail("mark() should throw UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
View Full Code Here

    }

    @Override
    public boolean markSupported() {
      Reader rdr = getReader();
      return (rdr != null && rdr.markSupported());
    }

    @Override
    public void mark(int readAheadLimit) throws IOException {
      Reader rdr = getReader();
View Full Code Here

        assertEquals(-1, reader.read());
        assertFalse(reader.ready());
        assertEquals(0, reader.skip(2));
        assertEquals(0, reader.skip(-1));
       
        assertTrue(reader.markSupported());
        reader = sb.asReader();
        assertEquals('s', reader.read());
        reader.mark(-1);
        char[] array = new char[3];
        assertEquals(3, reader.read(array, 0, 3));
View Full Code Here

    public void testMarkAndReset() throws Exception {
        int position = 0;
        final int readlimit = 10;
        final Reader reader = new TestNullReader(100, true, false);

        assertTrue("Mark Should be Supported", reader.markSupported());

        // No Mark
        try {
            reader.reset();
            fail("Read limit exceeded, expected IOException ");
View Full Code Here

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

        try {
            reader.mark(5);
            fail("mark() should throw UnsupportedOperationException");
        } catch (final UnsupportedOperationException e) {
View Full Code Here

    /** Test {@link Reader#markSupported()}. */
    @Test
    public void testMarkSupported() throws Exception {
        final Reader reader = new CharSequenceReader("FooBar");
        assertTrue(reader.markSupported());
        reader.close();
    }

    /** Test {@link Reader#mark(int)}. */
    @Test
View Full Code Here

            }
            //JD: GEOS-323
           
            //DJB: add support for POST loggin
            if (LOGGER.isLoggable(Level.FINE)) {
              if (xml.markSupported())
              {
                  // a little protection for large POSTs (ie. updates)
                    // for FINE, I assume people just want to see the "normal" ones - not the big ones
                    // for FINER, I assume they would want to see a bit more
                    // for FINEST, I assume they would want to see even more
View Full Code Here

    Reader reader = null;
   
    try {
      reader = createReader(in, encoding);
     
      if (reader.markSupported()) {
        reader.mark(IN_MEMORY_THRESHOLD);
      }
     
      long length = StreamUtil.getContentLength(reader);
     
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.