Module ij
Package ij.io

# Class RoiEncoder

java.lang.Object
ij.io.RoiEncoder

public class RoiEncoder extends Object
Saves an ROI to a file or stream. RoiDecoder.java has a description of the file format.

See Also:
  - `RoiDecoder`
  - `RoiReader`

## Constructor Summary

Constructors
Constructor
Description
`RoiEncoder(OutputStream f)`
Creates an RoiEncoder using the specified OutputStream.
`RoiEncoder(String path)`
Creates an RoiEncoder using the specified path.

## Method Summary

Modifier and Type
Method
Description
`static boolean`
`save(Roi roi, String path)`
Saves the specified ROI as a file, returning 'true' if successful.
`static byte[]`
`saveAsByteArray(Roi roi)`
Saves the specified ROI as a byte array.
`void`
`write(Roi roi)`
Save the Roi to the file of stream.

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

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

## Constructor Details

### RoiEncoder

public RoiEncoder(String path)
Creates an RoiEncoder using the specified path.

### RoiEncoder

public RoiEncoder(OutputStream f)
Creates an RoiEncoder using the specified OutputStream.

## Method Details

### save

public static boolean save(Roi roi, String path)
Saves the specified ROI as a file, returning 'true' if successful.

### write

public void write(Roi roi) throws IOException
Save the Roi to the file of stream.

Throws:
  `IOException`

### saveAsByteArray

public static byte[] saveAsByteArray(Roi roi)
Saves the specified ROI as a byte array.