loci.formats.out

## Class JavaWriter

- java.lang.Object
- - loci.formats.FormatHandler
  - - loci.formats.FormatWriter
    - - loci.formats.out.JavaWriter

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, ICompressedTileWriter, IFormatHandler, IFormatWriter, IMetadataConfigurable, IPyramidHandler

      public class JavaWriter
      extends FormatWriter

  JavaWriter is the file format writer for Java source code. At the moment, this code is just a very simple container for pixel data.

- - ### Field Summary

    - ### Fields inherited from class loci.formats.FormatWriter

      `cm, compression, compressionTypes, fps, initialized, interleaved, metadataRetrieve, options, out, resolution, resolutionData, sequential, series, validBits`

    - ### Fields inherited from class loci.formats.FormatHandler

      `COMPRESSION_SUFFIXES, currentId, format, LOGGER, metadataOptions, suffixes`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JavaWriter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canDoStacks()` Reports whether the writer can save multiple images to a single file.
    `void` | `close()`
    `int[]` | `getPixelTypes(java.lang.String codec)` Gets the supported pixel types for the given codec.
    `void` | `saveBytes(int no, byte[] buf, int x, int y, int w, int h)` Saves the given image tile to the current series in the current file.
    `void` | `setId(java.lang.String id)` Initializes a writer from the input file name.
    `protected void` | `writeFooter()`
    `protected void` | `writeHeader()`
    `protected void` | `writePlane(java.lang.String varName, byte[] array, int w, int h)`
    `protected void` | `writePlane(java.lang.String varName, double[] array, int w, int h)`
    `protected void` | `writePlane(java.lang.String varName, float[] array, int w, int h)`
    `protected void` | `writePlane(java.lang.String varName, int[] array, int w, int h)`
    `protected void` | `writePlane(java.lang.String varName, long[] array, int w, int h)`
    `protected void` | `writePlane(java.lang.String varName, short[] array, int w, int h)`

    - ### Methods inherited from class loci.formats.FormatWriter

      `changeOutputFile, checkParams, createOutputStream, getCodecOptions, getColorModel, getCompression, getCompressionTypes, getFramesPerSecond, getMetadataRetrieve, getPixelTypes, getPlaneCount, getPlaneCount, getResolution, getResolutionCount, getResolutions, getSamplesPerPixel, getSamplesPerPixel, getSeries, getSizeX, getSizeY, getTileSizeX, getTileSizeY, hasResolutions, isFullPlane, isInterleaved, isSupportedType, saveBytes, saveBytes, savePlane, savePlane, savePlane, seekToPlaneOffset, setCodecOptions, setColorModel, setCompression, setFramesPerSecond, setInterleaved, setMetadataRetrieve, setResolution, setResolutions, setSeries, setTileSizeX, setTileSizeY, setValidBitsPerPixel, setWriteSequentially`

    - ### Methods inherited from class loci.formats.FormatHandler

      `checkSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, isThisType, setMetadataOptions`

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

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

    - ### Methods inherited from interface loci.formats.IFormatHandler

      `getFormat, getNativeDataType, getSuffixes, isThisType`

    - ### Methods inherited from interface loci.formats.IMetadataConfigurable

      `getMetadataOptions, getSupportedMetadataLevels, setMetadataOptions`

    - ### Methods inherited from interface loci.formats.ICompressedTileWriter

      `getCodec, saveCompressedBytes`

- - ### Constructor Detail

    - #### JavaWriter

          public JavaWriter()

  - ### Method Detail

    - #### saveBytes

          public void saveBytes(int no,
                                byte[] buf,
                                int x,
                                int y,
                                int w,
                                int h)
                         throws FormatException,
                                java.io.IOException

      Description copied from interface: `IFormatWriter`
      Saves the given image tile to the current series in the current file.
      Parameters:
        `no` - the plane index within the series.
        `buf` - the byte array that represents the image tile.
        `x` - the X coordinate of the upper-left corner of the image tile.
        `y` - the Y coordinate of the upper-left corner of the image tile.
        `w` - the width (in pixels) of the image tile.
        `h` - the height (in pixels) of the image tile.
      Throws:
        `FormatException` - if one of the parameters is invalid.
        `java.io.IOException` - if there was a problem writing to the file.
      See Also:
        `IFormatWriter.saveBytes(int, byte[], int, int, int, int)`

    - #### canDoStacks

          public boolean canDoStacks()

      Description copied from interface: `IFormatWriter`
      Reports whether the writer can save multiple images to a single file.
      Specified by:
        `canDoStacks` in interface `IFormatWriter`
      Overrides:
        `canDoStacks` in class `FormatWriter`

    - #### getPixelTypes

          public int[] getPixelTypes(java.lang.String codec)

      Description copied from interface: `IFormatWriter`
      Gets the supported pixel types for the given codec.
      Specified by:
        `getPixelTypes` in interface `IFormatWriter`
      Overrides:
        `getPixelTypes` in class `FormatWriter`

    - #### setId

          public void setId(java.lang.String id)
                     throws FormatException,
                            java.io.IOException

      Description copied from class: `FormatWriter`
      Initializes a writer from the input file name. Initializes a `RandomAccessOutputStream` for the output file and initializes the metadata for all the series using `FormatWriter.setSeries(int)`.
      Specified by:
        `setId` in interface `IFormatHandler`
      Overrides:
        `setId` in class `FormatWriter`
      Parameters:
        `id` - a `String` specifying the path to the file
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### close

          public void close()
                     throws java.io.IOException

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Overrides:
        `close` in class `FormatWriter`
      Throws:
        `java.io.IOException`

    - #### writeHeader

          protected void writeHeader()
                              throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### writePlane

          protected void writePlane(java.lang.String varName,
                                    byte[] array,
                                    int w,
                                    int h)
                             throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### writePlane

          protected void writePlane(java.lang.String varName,
                                    short[] array,
                                    int w,
                                    int h)
                             throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### writePlane

          protected void writePlane(java.lang.String varName,
                                    int[] array,
                                    int w,
                                    int h)
                             throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### writePlane

          protected void writePlane(java.lang.String varName,
                                    long[] array,
                                    int w,
                                    int h)
                             throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### writePlane

          protected void writePlane(java.lang.String varName,
                                    float[] array,
                                    int w,
                                    int h)
                             throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### writePlane

          protected void writePlane(java.lang.String varName,
                                    double[] array,
                                    int w,
                                    int h)
                             throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### writeFooter

          protected void writeFooter()
                              throws java.io.IOException

      Throws:
        `java.io.IOException`

Copyright © 2026 Open Microscopy Environment