Package org.ajax4jsf.io

Examples of org.ajax4jsf.io.FastBufferReader


        for (int i = 0; i < bytes.length; i++) {
            output.write(bytes[i]);
        }

        FastBufferWriter output2 = output.convertToWriter("UTF-8");
        FastBufferReader input = new FastBufferReader(output2);
        StringBuffer sb = new StringBuffer();

        // use for reading unconvenient array length.
        char[] bs = new char[ARRAY_LENGTH];
        int l = 0;

        while ((l = input.read(bs, READ_OFF, READ_LENGTH)) >= 0) {
            if (BUILD_STRING) {
                sb.append(new String(bs, READ_OFF, l));
            }
        }
View Full Code Here


    /**
     * Convert saved context to stream for parsing
     * @return stream from saved content
     */
    public Reader getContentAsReader() {
      FastBufferReader result = null;     
        String encoding = this.getCharacterEncoding() ;
///        String content;
        if (isUseWriter()) {
      printWriter.flush();
      printWriter.close();
      result = new FastBufferReader(stringWriter);
///      content = stringWriter.toString();
    } else if (isUseStream()) {
          try {
        servletOutputStream.flush();
      } catch (IOException ex) {
        log.warn(Messages.getMessage(Messages.FLUSH_BUFFERED_STREAM_ERROR), ex);
      }
      try {
        FastBufferWriter writer = byteStream.convertToWriter(encoding);
        result = new FastBufferReader(writer);
///        content = byteStream.toString(encoding);
      } catch (UnsupportedEncodingException e) {
        log.warn(Messages.getMessage(Messages.UNSUPPORTED_ENCODING_WARNING_2), e);
        FastBufferWriter writer = byteStream.convertToWriter();
        result = new FastBufferReader(writer);
///        content = byteStream.toString();
      }
        } else  {
            if (log.isDebugEnabled()) {
                log.debug(Messages.getMessage(Messages.NO_WRITER_CALLED_INFO));
View Full Code Here

//    } else {
//      haveHtml = true;
//    }
    // Send rest of input.
    if (in instanceof FastBufferReader) {
      FastBufferReader fastIn = (FastBufferReader) in;
      fastIn.writeTo(out);

    } else {
      char[] buffer = new char[1024];
      int buffersCount = -1;
      int length;
View Full Code Here

    } else {
      haveHtml = true;
    }
    // Send rest of input.
    if (in instanceof FastBufferReader) {
      FastBufferReader fastIn = (FastBufferReader) in;
      fastIn.writeTo(out);

    } else {
      char[] buffer = new char[1024];
      int buffersCount = -1;
      int length;
View Full Code Here

    /**
     * Convert saved context to stream for parsing
     * @return stream from saved content
     */
    public Reader getContentAsReader() {
      FastBufferReader result = null;     
        String encoding = this.getCharacterEncoding() ;
///        String content;
        if (isUseWriter()) {
      printWriter.flush();
      printWriter.close();
      result = new FastBufferReader(stringWriter);
///      content = stringWriter.toString();
    } else if (isUseStream()) {
          try {
        servletOutputStream.flush();
      } catch (IOException ex) {
        log.warn(Messages.getMessage(Messages.FLUSH_BUFFERED_STREAM_ERROR), ex);
      }
      try {
        FastBufferWriter writer = byteStream.convertToWriter(encoding);
        result = new FastBufferReader(writer);
///        content = byteStream.toString(encoding);
      } catch (UnsupportedEncodingException e) {
        log.warn(Messages.getMessage(Messages.UNSUPPORTED_ENCODING_WARNING_2), e);
        FastBufferWriter writer = byteStream.convertToWriter();
        result = new FastBufferReader(writer);
///        content = byteStream.toString();
      }
        } else  {
            if (log.isDebugEnabled()) {
                log.debug(Messages.getMessage(Messages.NO_WRITER_CALLED_INFO));
View Full Code Here

        assertTrue(nextBuffer.getUsedSize() < nextBuffer.getCacheSize());
        firstBuffer.compact();
        assertTrue(firstBuffer.getUsedSize() == firstBuffer.getCacheSize());
        assertTrue(nextBuffer.getUsedSize() == nextBuffer.getCacheSize());

        FastBufferReader reader = new FastBufferReader(firstBuffer);

        for (int i = 0; i < itemsTowWrite; i++) {
            assertEquals(i, reader.read());
        }

        reader.close();
    }
View Full Code Here

        // write it one more time by one byte
        for (int i = 0; i < bytes.length; i++) {
            output.write(bytes[i]);
        }

        FastBufferReader input = new FastBufferReader(output);
        StringBuffer sb = new StringBuffer();

        // use for reading unconvenient array length.
        char[] bs = new char[ARRAY_LENGTH];
        int l = 0;

        while ((l = input.read(bs, READ_OFF, READ_LENGTH)) >= 0) {
            if (BUILD_STRING) {
                sb.append(new String(bs, READ_OFF, l));
            }
        }
View Full Code Here

    } else {
      haveHtml = true;
    }
    // Send rest of input.
    if (in instanceof FastBufferReader) {
      FastBufferReader fastIn = (FastBufferReader) in;
      fastIn.writeTo(out);

    } else {
      char[] buffer = new char[1024];
      int buffersCount = -1;
      int length;
View Full Code Here

//    } else {
//      haveHtml = true;
//    }
    // Send rest of input.
    if (in instanceof FastBufferReader) {
      FastBufferReader fastIn = (FastBufferReader) in;
      fastIn.writeTo(out);

    } else {
      char[] buffer = new char[1024];
      int buffersCount = -1;
      int length;
View Full Code Here

    /**
     * Convert saved context to stream for parsing
     * @return stream from saved content
     */
    public Reader getContentAsReader() {
      FastBufferReader result = null;     
        String encoding = this.getCharacterEncoding() ;
///        String content;
        if (isUseWriter()) {
      printWriter.flush();
      printWriter.close();
      result = new FastBufferReader(stringWriter);
///      content = stringWriter.toString();
    } else if (isUseStream()) {
          try {
        servletOutputStream.flush();
      } catch (IOException ex) {
        log.warn(Messages.getMessage(Messages.FLUSH_BUFFERED_STREAM_ERROR), ex);
      }
      try {
        FastBufferWriter writer = byteStream.convertToWriter(encoding);
        result = new FastBufferReader(writer);
///        content = byteStream.toString(encoding);
      } catch (UnsupportedEncodingException e) {
        log.warn(Messages.getMessage(Messages.UNSUPPORTED_ENCODING_WARNING_2), e);
        FastBufferWriter writer = byteStream.convertToWriter();
        result = new FastBufferReader(writer);
///        content = byteStream.toString();
      }
        } else  {
            if (log.isDebugEnabled()) {
                log.debug(Messages.getMessage(Messages.NO_WRITER_CALLED_INFO));
View Full Code Here

TOP

Related Classes of org.ajax4jsf.io.FastBufferReader

Copyright © 2018 www.massapicom. 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.