当前位置: 首页>>代码示例>>Java>>正文


Java CharArrayWriter.size方法代码示例

本文整理汇总了Java中java.io.CharArrayWriter.size方法的典型用法代码示例。如果您正苦于以下问题:Java CharArrayWriter.size方法的具体用法?Java CharArrayWriter.size怎么用?Java CharArrayWriter.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.CharArrayWriter的用法示例。


在下文中一共展示了CharArrayWriter.size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readLine

import java.io.CharArrayWriter; //导入方法依赖的package包/类
/**
 * InputStreamReader를 통해 한줄을 읽어주는 메소드. 
 * BufferedReader를 사용하면 buffering되는 과정에서 binary file data를
 * 읽어버리는 경우가 발생할 위험이 있으므로, 직접 구현되었다.
 */
private String readLine() throws IOException
{
	CharArrayWriter caw = new CharArrayWriter(40);
	int buf;
	while( (buf=in.read())!=-1 )
	{
		if( buf=='\r' ) 
			continue;

		if( buf=='\n' )
			return caw.toString();
		caw.write( buf );
	}
	if( caw.size()!=0 )
		return caw.toString();
	return null;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:VolatileDownloader.java

示例2: logEvent0

import java.io.CharArrayWriter; //导入方法依赖的package包/类
@Override
protected void logEvent0(PciAuditEvent event) {
    if (!initialized) {
        LOG.error("syslog audit not initialiazed");
        return;
    }

    CharArrayWriter msg = event.toCharArrayWriter(prefix);
    final int n = msg.size();
    if (n > maxMessageLength) {
        LOG.warn("syslog message exceeds the maximal allowed length: {} > {}, ignore it",
                n, maxMessageLength);
        return;
    }

    SyslogMessage sm = new SyslogMessage();
    sm.setFacility(syslog.getDefaultFacility());
    if (notEmpty(localname)) {
        sm.setHostname(localname);
    }

    sm.setSeverity(getSeverity(event.level()));
    sm.setMsg(msg);

    try {
        syslog.sendMessage(sm);
    } catch (IOException ex) {
        LOG.error("could not send syslog message: {}", ex.getMessage());
        LOG.debug("could not send syslog message", ex);
    }
}
 
开发者ID:xipki,项目名称:xitk,代码行数:32,代码来源:SyslogAuditServiceImpl.java

示例3: toStackTrace

import java.io.CharArrayWriter; //导入方法依赖的package包/类
public static String toStackTrace(Throwable error, int cutoff) {
  // default initial size is 32 chars
  CharArrayWriter buffer = new CharArrayWriter(8 * 1024);
  error.printStackTrace(new PrintWriter(buffer));
  return buffer.size() < cutoff ? buffer.toString()
      : buffer.toString().substring(0, cutoff);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:ErrorPage.java

示例4: parseTemplateText

import java.io.CharArrayWriter; //导入方法依赖的package包/类
private void parseTemplateText(Node parent) throws JasperException {

        if (!reader.hasMoreInput())
            return;

        CharArrayWriter ttext = new CharArrayWriter();

        int ch = reader.nextChar();
        while (ch != -1) {
            if (ch == '<') {
                // Check for "<\%"
                if (reader.peekChar(0) == '\\' && reader.peekChar(1) == '%') {
                    ttext.write(ch);
                    // Swallow the \
                    reader.nextChar();
                    ttext.write(reader.nextChar());
                } else {
                    if (ttext.size() == 0) {
                        ttext.write(ch);
                    } else {
                        reader.pushChar();
                        break;
                    }
                }
            } else if (ch == '\\' && !pageInfo.isELIgnored()) {
                int next = reader.peekChar(0);
                if (next == '$' || next == '#') {
                    ttext.write(reader.nextChar());
                } else {
                    ttext.write(ch);
                }
            } else if ((ch == '$' || ch == '#' && !pageInfo.isDeferredSyntaxAllowedAsLiteral()) &&
                    !pageInfo.isELIgnored()) {
                if (reader.peekChar(0) == '{') {
                    reader.pushChar();
                    break;
                } else {
                    ttext.write(ch);
                }
            } else {
                ttext.write(ch);
            }
            ch = reader.nextChar();
        }

        @SuppressWarnings("unused")
        Node unused = new Node.TemplateText(ttext.toString(), start, parent);
    }
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:49,代码来源:Parser.java

示例5: parseTemplateText

import java.io.CharArrayWriter; //导入方法依赖的package包/类
private void parseTemplateText(Node parent) throws JasperException {

		if (!reader.hasMoreInput())
			return;

		CharArrayWriter ttext = new CharArrayWriter();

		int ch = reader.nextChar();
		while (ch != -1) {
			if (ch == '<') {
				// Check for "<\%"
				if (reader.peekChar(0) == '\\' && reader.peekChar(1) == '%') {
					ttext.write(ch);
					// Swallow the \
					reader.nextChar();
					ttext.write(reader.nextChar());
				} else {
					if (ttext.size() == 0) {
						ttext.write(ch);
					} else {
						reader.pushChar();
						break;
					}
				}
			} else if (ch == '\\' && !pageInfo.isELIgnored()) {
				int next = reader.peekChar(0);
				if (next == '$' || next == '#') {
					ttext.write(reader.nextChar());
				} else {
					ttext.write(ch);
				}
			} else if ((ch == '$' || ch == '#' && !pageInfo.isDeferredSyntaxAllowedAsLiteral())
					&& !pageInfo.isELIgnored()) {
				if (reader.peekChar(0) == '{') {
					reader.pushChar();
					break;
				} else {
					ttext.write(ch);
				}
			} else {
				ttext.write(ch);
			}
			ch = reader.nextChar();
		}

		@SuppressWarnings("unused")
		Node unused = new Node.TemplateText(ttext.toString(), start, parent);
	}
 
开发者ID:how2j,项目名称:lazycat,代码行数:49,代码来源:Parser.java


注:本文中的java.io.CharArrayWriter.size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。