Class Writers

java.lang.Object
org.dishevelled.compress.Writers

public final class Writers extends Object
File, path, and output stream writers with support for bgzf, gzip, bzip2, xz, or zstd compression.
Author:
Michael Heuer
  • Method Summary

    Modifier and Type
    Method
    Description
    Create and return a new buffered print writer with bgzf compression for the specified output stream.
    Create and return a new buffered print writer with bzip2 compression for the specified output stream.
    Create and return a new buffered print writer with gzip compression for the specified output stream.
    writer(File file)
    Create and return a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified file or stdout if the file is null or -.
    writer(File file, boolean append)
    Create and return a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified file or stdout if the file is null or -.
    writer(String pathName)
    Create and return a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified path name or stdout if the path name is null or -.
    writer(String pathName, boolean append)
    Create and return a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified path name or stdout if the path name is null or -.
    writer(Path path)
    Create and return a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified path or stdout if the path is null or -.
    writer(Path path, boolean append)
    Create and return a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified path or stdout if the path is null or -.
    Create and return a new buffered print writer with XZ compression for the specified output stream.
    Create and return a new buffered print writer with Zstandard (zstd) compression for the specified output stream.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • bgzfOutputStreamWriter

      public static PrintWriter bgzfOutputStreamWriter(OutputStream outputStream) throws IOException
      Create and return a new buffered print writer with bgzf compression for the specified output stream.
      Parameters:
      outputStream - output stream, must not be null
      Returns:
      a new buffered print writer with bgzf compression for the specified output stream
      Throws:
      IOException - if an I/O error occurs
      Since:
      1.3
    • gzipOutputStreamWriter

      public static PrintWriter gzipOutputStreamWriter(OutputStream outputStream) throws IOException
      Create and return a new buffered print writer with gzip compression for the specified output stream.
      Parameters:
      outputStream - output stream, must not be null
      Returns:
      a new buffered print writer with gzip compression for the specified output stream
      Throws:
      IOException - if an I/O error occurs
    • bzip2OutputStreamWriter

      public static PrintWriter bzip2OutputStreamWriter(OutputStream outputStream) throws IOException
      Create and return a new buffered print writer with bzip2 compression for the specified output stream.
      Parameters:
      outputStream - output stream, must not be null
      Returns:
      a new buffered print writer with bzip2 compression for the specified output stream
      Throws:
      IOException - if an I/O error occurs
    • xzOutputStreamWriter

      public static PrintWriter xzOutputStreamWriter(OutputStream outputStream) throws IOException
      Create and return a new buffered print writer with XZ compression for the specified output stream.
      Parameters:
      outputStream - output stream, must not be null
      Returns:
      a new buffered print writer with XZ compression for the specified output stream
      Throws:
      IOException - if an I/O error occurs
      Since:
      1.5
    • zstdOutputStreamWriter

      public static PrintWriter zstdOutputStreamWriter(OutputStream outputStream) throws IOException
      Create and return a new buffered print writer with Zstandard (zstd) compression for the specified output stream.
      Parameters:
      outputStream - output stream, must not be null
      Returns:
      a new buffered print writer with Zstandard (zstd) compression for the specified output stream
      Throws:
      IOException - if an I/O error occurs
      Since:
      1.4
    • writer

      public static PrintWriter writer(@Nullable String pathName) throws IOException
      Create and return a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified path name or stdout if the path name is null or -.
      Parameters:
      pathName - path name, if any
      Returns:
      a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified path name or stdout if the path name is null or -
      Throws:
      IOException - if an I/O error occurs
      Since:
      1.6
    • writer

      public static PrintWriter writer(@Nullable String pathName, boolean append) throws IOException
      Create and return a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified path name or stdout if the path name is null or -.
      Parameters:
      pathName - path name, if any
      append - true to append to the specified path name
      Returns:
      a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified path name or stdout if the path name is null or -
      Throws:
      IOException - if an I/O error occurs
      Since:
      1.6
    • writer

      public static PrintWriter writer(@Nullable Path path) throws IOException
      Create and return a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified path or stdout if the path is null or -.
      Parameters:
      path - path, if any
      Returns:
      a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified path or stdout if the path is null or -
      Throws:
      IOException - if an I/O error occurs
      Since:
      1.6
    • writer

      public static PrintWriter writer(@Nullable Path path, boolean append) throws IOException
      Create and return a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified path or stdout if the path is null or -.
      Parameters:
      path - path, if any
      append - true to append to the specified path
      Returns:
      a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified path or stdout if the path is null or -
      Throws:
      IOException - if an I/O error occurs
      Since:
      1.6
    • writer

      public static PrintWriter writer(@Nullable File file) throws IOException
      Create and return a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified file or stdout if the file is null or -.
      Parameters:
      file - file, if any
      Returns:
      a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified file or stdout if the file is null or -
      Throws:
      IOException - if an I/O error occurs
    • writer

      public static PrintWriter writer(@Nullable File file, boolean append) throws IOException
      Create and return a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified file or stdout if the file is null or -.
      Parameters:
      file - file, if any
      append - true to append to the specified file
      Returns:
      a new buffered print writer with support for bgzf, gzip, bzip2, xz, or zstd compression for the specified file or stdout if the file is null or -
      Throws:
      IOException - if an I/O error occurs