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

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

Introduction

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

Prototype

long size

To view the source code for org.apache.wicket.util.io ByteCountingOutputStream size.

Click Source Link

Usage

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

public static long sizeOf(Serializable object) {
    if (object == null) {
        return 0;
    }//from w  ww  .ja  v a 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;
    }
}