Example usage for org.apache.wicket.util.io ByteCountingOutputStream ByteCountingOutputStream

List of usage examples for org.apache.wicket.util.io ByteCountingOutputStream ByteCountingOutputStream

Introduction

In this page you can find the example usage for org.apache.wicket.util.io ByteCountingOutputStream ByteCountingOutputStream.

Prototype

ByteCountingOutputStream

Source Link

Usage

From source file:com.quangphuong.crawler.util.Agent.java

public static long sizeOf(Serializable object) {
    if (object == null) {
        return 0;
    }// w  ww.  j a  va  2  s .c  om

    try {
        final ByteCountingOutputStream out = new ByteCountingOutputStream();
        new ObjectOutputStream(out).writeObject(object);
        out.close();
        return out.size();
    } catch (IOException e) {
        return -1;
    }
}