class MessageSlicer implements AutoCloseable {

    public boolean slice(final SliceOptions options) {
        final Identifier identifier = options.getIdentifier();
        final Serializable message = options.getMessage();
        final FileBackedOutputStream fileBackedStream;
        if (message != null) {
            LOG.debug("{}: slice: identifier: {}, message: {}", logContext, identifier, message);

            requireNonNull(fileBackedStreamFactory,
                    "The FiledBackedStreamFactory must be set in order to call this slice method");

            // Serialize the message to a FileBackedOutputStream.
            fileBackedStream = fileBackedStreamFactory.newInstance();
            try (ObjectOutputStream out = new ObjectOutputStream(fileBackedStream)) {
                out.writeObject(message);
            } catch (IOException e) {
                LOG.debug("{}: Error serializing message for {}", logContext, identifier, e);
                fileBackedStream.cleanup();
                options.getOnFailureCallback().accept(e);
                return false;
            }
        } else {
            fileBackedStream = options.getFileBackedStream();
        }

        return initializeSlicing(options, fileBackedStream);
    }

      MessageSlicer(final Builder builder);

}