class PdfBoxMigration implements Migrate, Serializable {

    private MigrateResult textMigration(
            final DigitalObject digitalObject, final ServiceReport report) {
        try {
            final TextExtractor te = new TextExtractor();
            final String textBlob = te.getText(
                    digitalObject.getContent().getInputStream());
            final DigitalObject.Builder factory =
                    new DigitalObject.Builder(
                            Content.byValue(textBlob.getBytes()));
            factory.title(digitalObject.getTitle() + ".txt");
            // Unicode File format (UTF-16)
            factory.format(outputformatUnicode);
            final DigitalObject textObject = factory.build();

            return new MigrateResult(textObject, report);

        } catch (Exception e) {
            e.printStackTrace();
            return this.fail(new ServiceReport(Type.ERROR, Status.TOOL_ERROR, e
                    .toString()));
        }
    }

}