Here you can find the source of writeStreamFromString(String serializePath)
public static ObjectOutputStream writeStreamFromString(String serializePath) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; import java.util.zip.GZIPOutputStream; public class Main { public static ObjectOutputStream writeStreamFromString(String serializePath) throws IOException { ObjectOutputStream oos;// w w w . j a va 2s . co m if (serializePath.endsWith(".gz")) { oos = new ObjectOutputStream( new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(serializePath)))); } else { oos = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(serializePath))); } return oos; } }