Skip to content

API Reference

This section provides complete API reference documentation for the EPUBime library. EPUBime is a pure Java library for parsing EPUB file format, supporting both EPUB 2 and EPUB 3 formats. The library strictly follows the Single Responsibility Principle (SRP).

  • EpubReader - Modern Fluent API focused on API coordination and user interaction
  • EpubReaderConfig - EpubReader configuration class managing parsing options
  • AsyncEpubProcessor - Asynchronous processor supporting async parsing and processing

Core Data Models

Dedicated Processor Classes

Enhanced Feature Classes

Exception Handling

  • Exception Classes - EPUBime's exception class hierarchy, all exceptions inherit from BaseEpubException

Overview

EPUBime provides a modernized API design that strictly follows the Single Responsibility Principle:

Use EpubReader and EpubReaderConfig for configurable parsing:

java
// Use default configuration
EpubBook book = EpubReader.fromFile(epubFile).parse();

// Use custom configuration
EpubReaderConfig config = new EpubReaderConfig()
    .withCache(true)
    .withLazyLoading(false)
    .withParallelProcessing(true);
EpubBook book = EpubReader.fromFile(epubFile, config).parse();

Dedicated Processor Pattern

According to the Single Responsibility Principle, different operations use dedicated processors:

java
// File reading
EpubFileReader fileReader = new EpubFileReader(epubFile);
String content = fileReader.readContent("mimetype");

// Book processing
EpubResource cover = EpubBookProcessor.getCover(book);

// Stream processing
EpubStreamProcessor streamProcessor = new EpubStreamProcessor(epubFile);
streamProcessor.processBookChapters(book, (chapter, inputStream) -> {
    // Process chapter content
});

Traditional Parsing API

Use EpubParser for core parsing:

java
EpubParser parser = new EpubParser(epubFile);
EpubBook book = parser.parse();

Async Processing

Use AsyncEpubProcessor for asynchronous operations:

java
AsyncEpubProcessor processor = new AsyncEpubProcessor();
EpubReaderConfig config = new EpubReaderConfig().withCache(true);
CompletableFuture<EpubBook> future = processor.parseBookAsync(epubFile, true, false);

Select a class name from the left navigation bar to view detailed API documentation.

Released under the MIT License