Java OutputStream Write writeStreamFromString(String serializePath)

Here you can find the source of writeStreamFromString(String serializePath)

Description

write Stream From String

License

Open Source License

Declaration

public static ObjectOutputStream writeStreamFromString(String serializePath) throws IOException 

Method Source Code


//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;
    }
}

Related

  1. writeStream(String content, String charset, OutputStream outputStream)
  2. writeStreamBuffered(final Reader in, final Writer out)
  3. writeStreamCharwise(final Reader in, final Writer out)
  4. writeStreamCharwiseLimited(final Reader in, final Writer out, final int len)
  5. writeStreamFromString(String contents, OutputStream outputStream)
  6. writeStreamInFile(File f, InputStream in)
  7. writeStreamText(OutputStream out, String text)
  8. writeStreamToArray(InputStream stream)
  9. writeStreamToStream(InputStream in, OutputStream out)