com.google.zxing.client.j2se

## Class MatrixToImageWriter

- java.lang.Object
- - com.google.zxing.client.j2se.MatrixToImageWriter

-     public final class MatrixToImageWriter
      extends Object

  Writes a `BitMatrix` to `BufferedImage`, file or stream. Provided here instead of core since it depends on Java SE libraries.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static BufferedImage` | `toBufferedImage(BitMatrix matrix)` Renders a `BitMatrix` as an image, where "false" bits are rendered as white, and "true" bits are rendered as black.
    `static BufferedImage` | `toBufferedImage(BitMatrix matrix, MatrixToImageConfig config)` As `toBufferedImage(BitMatrix)`, but allows customization of the output.
    `static void` | `writeToPath(BitMatrix matrix, String format, Path file)` Writes a `BitMatrix` to a file with default configuration.
    `static void` | `writeToPath(BitMatrix matrix, String format, Path file, MatrixToImageConfig config)` As `writeToFile(BitMatrix, String, File)`, but allows customization of the output.
    `static void` | `writeToStream(BitMatrix matrix, String format, OutputStream stream)` Writes a `BitMatrix` to a stream with default configuration.
    `static void` | `writeToStream(BitMatrix matrix, String format, OutputStream stream, MatrixToImageConfig config)` As `writeToStream(BitMatrix, String, OutputStream)`, but allows customization of the output.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### toBufferedImage

          public static BufferedImage toBufferedImage(BitMatrix matrix)

      Renders a `BitMatrix` as an image, where "false" bits are rendered as white, and "true" bits are rendered as black. Uses default configuration.
      Parameters:
        `matrix` - `BitMatrix` to write
      Returns:
        `BufferedImage` representation of the input

    - #### toBufferedImage

          public static BufferedImage toBufferedImage(BitMatrix matrix,
                                                      MatrixToImageConfig config)

      As `toBufferedImage(BitMatrix)`, but allows customization of the output.
      Parameters:
        `matrix` - `BitMatrix` to write
        `config` - output configuration
      Returns:
        `BufferedImage` representation of the input

    - #### writeToPath

          public static void writeToPath(BitMatrix matrix,
                                         String format,
                                         Path file)
                                  throws IOException

      Writes a `BitMatrix` to a file with default configuration.
      Parameters:
        `matrix` - `BitMatrix` to write
        `format` - image format
        `file` - file `Path` to write image to
      Throws:
        `IOException` - if writes to the stream fail
      See Also:
        `toBufferedImage(BitMatrix)`

    - #### writeToPath

          public static void writeToPath(BitMatrix matrix,
                                         String format,
                                         Path file,
                                         MatrixToImageConfig config)
                                  throws IOException

      As `writeToFile(BitMatrix, String, File)`, but allows customization of the output.
      Parameters:
        `matrix` - `BitMatrix` to write
        `format` - image format
        `file` - file `Path` to write image to
        `config` - output configuration
      Throws:
        `IOException` - if writes to the file fail

    - #### writeToStream

          public static void writeToStream(BitMatrix matrix,
                                           String format,
                                           OutputStream stream)
                                    throws IOException

      Writes a `BitMatrix` to a stream with default configuration.
      Parameters:
        `matrix` - `BitMatrix` to write
        `format` - image format
        `stream` - `OutputStream` to write image to
      Throws:
        `IOException` - if writes to the stream fail
      See Also:
        `toBufferedImage(BitMatrix)`

    - #### writeToStream

          public static void writeToStream(BitMatrix matrix,
                                           String format,
                                           OutputStream stream,
                                           MatrixToImageConfig config)
                                    throws IOException

      As `writeToStream(BitMatrix, String, OutputStream)`, but allows customization of the output.
      Parameters:
        `matrix` - `BitMatrix` to write
        `format` - image format
        `stream` - `OutputStream` to write image to
        `config` - output configuration
      Throws:
        `IOException` - if writes to the stream fail