All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.silentgo.json.stream.JSONCharStream Maven / Gradle / Ivy

There is a newer version: 0.0.9
Show newest version
package com.silentgo.json.stream;

import java.io.IOException;
import java.io.OutputStream;

/**
 * Project : json
 * Package : com.silentgo.json.stream
 *
 * @author teddyzhu
 *         

* Created by teddyzhu on 2017/1/25. */ public class JSONCharStream extends OutputStream { public char[] buf = new char[256]; public int count = 0; @Override public void write(int b) throws IOException { if (count == buf.length) { char[] newByte = new char[buf.length * 2]; System.arraycopy(buf, 0, newByte, 0, buf.length); buf = newByte; } buf[count++] = (char) b; } @Override public String toString() { return new String(buf, 0, count); } public void clear() { count = 0; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy