Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default language to Undefined instead of English #132

Open
wants to merge 575 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
575 commits
Select commit Hold shift + click to select a range
a75f483
more logging
psiegman Nov 27, 2010
a4b413f
Merge github.com:psiegman/epublib
psiegman Nov 27, 2010
a27ea12
misc. little fixes when reading/writing epubs
psiegman Nov 28, 2010
6b39125
add "save as ..." menu item
psiegman Nov 28, 2010
fbdcd39
Merge github.com:psiegman/epublib
psiegman Nov 29, 2010
7fccbe3
add scrolling across chapters
psiegman Nov 29, 2010
f900150
put icons on buttons
psiegman Nov 29, 2010
72fc77d
add layout change functionality
psiegman Nov 29, 2010
7d77749
add credits
psiegman Nov 29, 2010
07149a6
add navigate-to-fragmentId
psiegman Nov 30, 2010
6dbb982
disable guide and metadata table
psiegman Nov 30, 2010
133f73a
refactorings and renames
psiegman Nov 30, 2010
e1878d5
fix image loading and caching issues
psiegman Nov 30, 2010
e5a7b57
small renames and refactorings
psiegman Dec 1, 2010
f345c3e
refactorings & window layout changes
psiegman Dec 1, 2010
6775414
make ncxdocument reading 10 times faster
psiegman Dec 1, 2010
8ef6098
renames and refactorings
psiegman Dec 1, 2010
3b7ee26
make all domain classes serializable
psiegman Dec 5, 2010
0d7434f
replace Charset with String because Charsets are not serializable
psiegman Dec 5, 2010
7694809
make Navigator implement Serializable
psiegman Dec 5, 2010
c292630
fix infinite loop
psiegman Dec 5, 2010
7a5fe9b
remove unused class
psiegman Dec 5, 2010
06f2bd9
fix bugs in ImageLoaderCache
psiegman Dec 5, 2010
917e200
move Document cache filling to a background thread
psiegman Dec 5, 2010
3f92855
move from Charset to String
psiegman Dec 5, 2010
66b485c
odds and ends checkin
psiegman Dec 5, 2010
579e4d6
add addResourceAtLocation method to TableOfContents
psiegman Dec 5, 2010
c7953ad
add addResource method to spine
psiegman Dec 5, 2010
57df2d8
enable navigation by guide resource
psiegman Dec 5, 2010
d68dc9a
fix bug where images where not loaded when a new book was opened
psiegman Dec 6, 2010
49a04cc
gain more control over the html parsing
psiegman Dec 16, 2010
3c62d9d
remove unused class
psiegman Dec 16, 2010
33c00c7
refactoring to improve readability
psiegman Dec 16, 2010
2ff5d8b
doc change
psiegman Dec 16, 2010
b552aef
make fragment links within a document work in the viewer
psiegman Dec 16, 2010
f48f018
sort utility added in the TOCReference
psiegman Dec 16, 2010
e65579e
format pom xml
psiegman Dec 16, 2010
f9fa6e4
fix package name typo
psiegman Dec 17, 2010
be3e423
removed unnecessary annotation
psiegman Dec 17, 2010
5fa762a
ignore unknown filetypes when creating a book from a directory
psiegman Dec 17, 2010
8e3d10c
remove unused includes
psiegman Dec 17, 2010
2a3b91b
replace giant test book by something more manageable
psiegman Dec 17, 2010
591daaf
added a trim() that also trims  
psiegman Dec 17, 2010
6448324
clean up html splitter source test file
psiegman Dec 18, 2010
5d194db
remove unnecessary casts and imports
psiegman Dec 20, 2010
a89cc9c
name indexing thread
psiegman Dec 20, 2010
516c37c
log error when icon not found
psiegman Dec 20, 2010
6f98e4c
append character instead of string to StringBuilder
psiegman Dec 20, 2010
e8e6324
fix character encoding issue in unit test
psiegman Jan 27, 2011
1711727
add Yusuke Kamiyamane to the credits for the use of his Fugue icons
psiegman Jan 27, 2011
040d245
add 2 openbook dtd's that are used by some epubs
psiegman Jan 28, 2011
abca98d
improve default book
psiegman Jan 30, 2011
83a7536
add main maven and jboss repositories to pom
psiegman Feb 27, 2011
e628fc4
Add the ncxDocument and the opfDocument resource available via the
psiegman Feb 27, 2011
e171983
Update to HTMLCleaner 2.2
opensource21 Jan 14, 2011
3cbcc36
exclude jdom from dependencies
psiegman Apr 11, 2011
a5b254e
improve maven pom.xml
psiegman Apr 16, 2011
e7c368d
add documentation
psiegman Apr 26, 2011
cc81384
replace all uses of XMLStreamWriter with xmlpull XmlSerializer in ord…
May 7, 2011
0e13e62
rename test_cover.png to cover.png
psiegman May 7, 2011
22e7aaa
remove unused class
psiegman May 7, 2011
f8d5199
remove unused dependency
psiegman May 7, 2011
b640b1c
reduce the number of dependencies to reduce download size
psiegman May 7, 2011
bce9933
use commons-io XmlStreamReader instead of local copy of gdata Unicode…
psiegman May 8, 2011
e63779d
remove debug output
psiegman May 8, 2011
be52d52
remove dependencies to reduce download size
psiegman May 8, 2011
1d3f42f
remove google gdata from the CREDITS as their code is no longer used …
psiegman May 8, 2011
19a8e74
add a test change
psiegman May 9, 2011
2e77e06
split epublib in epublib-core and epublib-tools
psiegman May 9, 2011
105fd69
Merge branch 'master' of https://github.com/psiegman/epublib
psiegman May 9, 2011
5ae949d
divide existing code between epublib-core and epublib-tools
psiegman May 9, 2011
54e75a5
move more files from epublib-core to epublib-tools
psiegman May 9, 2011
579b39a
re-implement parts of commons-lang and commons-io in epublib-core to …
psiegman May 10, 2011
cd96ca0
add to the CREDITS that epublib-core uses code from apache commons io
psiegman May 10, 2011
690f76a
re-organize pom.xml's
psiegman May 10, 2011
eb3cdc4
move java file from test to main directory
psiegman May 10, 2011
4eddb3a
remove unused reference to XMLOutputFactory.
psiegman May 14, 2011
a685496
code and doc cleanup
psiegman May 14, 2011
17fa9b8
refactor code to make it easier to understand and use
psiegman May 14, 2011
93dc059
small refactoring
psiegman May 14, 2011
da0c2f8
update README
psiegman May 14, 2011
a0d6f34
move browsersupport package from epublib-tools to epublib-core
psiegman May 15, 2011
df77b24
add docs and a utility method
psiegman May 16, 2011
a61f43e
add docs
psiegman May 16, 2011
e815f1a
add 2 methods to Resources: getResourcesByMediaType and getResourcesB…
psiegman May 16, 2011
0e2c4f2
add doc and increase read buffer size
psiegman May 16, 2011
01b8d6e
use new Book utility method
psiegman May 16, 2011
6f89e82
docs, refactorings and more test for the TableOfContents
psiegman May 16, 2011
3d1844e
add to README.markdown
psiegman May 16, 2011
a38216e
bump version in epublib generator name
psiegman May 18, 2011
a30aabf
code cleanup
psiegman May 18, 2011
69f06bf
refactor the NCXDocument to make it easier to test
psiegman May 22, 2011
743b337
add new utility method to TableOfContents
psiegman May 22, 2011
d9605bd
add Writer output to EpubProcessorSupport
psiegman May 22, 2011
9b26f8d
improve both the performance and the correctness of the html cleanup
psiegman May 22, 2011
7a7265c
make extra sure that the coverpage is written as part of the guide
psiegman May 22, 2011
94be09f
fix reading of non-ascii text nodes from metadata
psiegman Jun 19, 2011
2ca05c1
improve performance by reusing last issued id when generating new sec…
psiegman Jul 3, 2011
eb53543
make the viewer less memory-hungry by only loading the images of the …
psiegman Jul 3, 2011
8b4d547
upgrade kxml2 version
psiegman Jul 3, 2011
4ebac27
code style fix
psiegman Jul 3, 2011
6b817a8
remove unused creation of XPathFactory in an attempt to make epublib-…
psiegman Jul 6, 2011
97f3fe0
add beginnings of gradle build system
psiegman Jul 7, 2011
fe81fea
add more documentation
psiegman Aug 3, 2011
ddd60da
add utility method BookProcessorPipeline
psiegman Sep 22, 2011
60a142d
remove unused logger
psiegman Sep 22, 2011
fa09df5
small code layout change
psiegman Sep 22, 2011
c561b03
remove last traces of javax.xml classes
psiegman Sep 22, 2011
3ab6635
use Resources internally instead of a custom Map<String, Resource>
psiegman Sep 22, 2011
143c0b3
improve gradle build
psiegman Sep 22, 2011
ddde63a
add distributionmanagement to pom file
psiegman Sep 22, 2011
b6af205
add classname option to Fileset2Epub
psiegman Sep 22, 2011
bcbdc15
remove document.setXmlStandalone() call because it doesn't work on an…
psiegman Oct 9, 2011
76695a1
Added support for lazy loading.
NightWhistler Dec 15, 2011
7841a8b
Pulled the specifics of lazy loading out of the library.
NightWhistler Dec 16, 2011
e6180f7
Extra documentation.
NightWhistler Dec 20, 2011
a1849c1
Merge pull request #12 from NightWhistler/master
psiegman Dec 25, 2011
b06f4bf
add new epub3 mediatypes
psiegman Feb 19, 2012
bc3bd73
fix a very old bug where setting a coverImage without a resource id w…
psiegman Feb 29, 2012
0d0d4a3
read other properties in metadata too
May 21, 2012
8d7ce4b
Merge pull request #21 from guetux/master
psiegman May 28, 2012
64c5dec
add test for DOMUtil
psiegman May 28, 2012
99195c5
add docs
psiegman May 28, 2012
8d4aef1
upgrade junit version to 4.10
psiegman May 28, 2012
39ffb56
work on support for epub 3.0 manifest item properties
psiegman May 28, 2012
c85da51
Working onejar-maven-plugin groupId.
Aug 21, 2012
dee7623
Added .gitignore files for target directories & test files.
Aug 21, 2012
2b40f7f
Fix concurrency issue with entity resolving
mnylen Sep 4, 2012
0ddb640
"a/b/../../c" used to be incorrectly normalized to "a/../c", instead …
Sep 4, 2012
9b4200b
Open the system we bbrowser for http requests.
Sep 4, 2012
c7db98e
Keep .gitignore tidy.
Sep 4, 2012
f9784bc
Keep .gitignore tidy.
Sep 4, 2012
1a6ebf6
Revert "Keep .gitignore tidy."
Sep 4, 2012
39f69c9
Revert "Keep .gitignore tidy."
Sep 4, 2012
6d6c617
Merge pull request #28 from lukepfarrar/fix_path_normalization
psiegman Sep 4, 2012
85f063e
Merge pull request #25 from mnylen/master
psiegman Sep 4, 2012
635c489
Merge pull request #27 from lukepfarrar/http_browser_launcher
psiegman Sep 4, 2012
93d07b4
Read language property from OPF
mnylen Sep 7, 2012
2430f44
Merge pull request #29 from mnylen/read-language-metadata-property
psiegman Sep 7, 2012
c6904ad
fix broken unit test
psiegman Oct 28, 2012
ce19c9f
remove all traces of gradle until it's fully working for epublib
psiegman Oct 28, 2012
d7496af
add .gitignore
psiegman Oct 28, 2012
93420b1
remove all traces of gradle until it's fully working for epublib
psiegman Oct 28, 2012
a27a125
docs
psiegman Oct 28, 2012
e7e346d
call getter instead of property for the inputEncoding
psiegman Oct 28, 2012
1edaf63
docs
psiegman Oct 28, 2012
54391be
call static methods statically
psiegman Oct 28, 2012
b6fb856
copy/paste commons-io 2.4 XmlStreamReader into epublib
psiegman Oct 28, 2012
0157061
add settings dir to .gitignore
psiegman Oct 28, 2012
b2e1fdd
renamed Constants.ENCODING to Constants.CHARACTER_ENCODING
psiegman Oct 28, 2012
69a16a3
fix path separator in CoverpageBookProcessor
psiegman Oct 28, 2012
0583591
apply lukepfarrar changes to XslBookProcessor
psiegman Oct 28, 2012
56ed9a5
remove System.out.println
psiegman Oct 28, 2012
175e8b2
fix code layout in xsl stylesheet
psiegman Oct 28, 2012
6bb3cd2
fix compile errors
psiegman Oct 28, 2012
8a3066a
move to version 3.1
psiegman Oct 28, 2012
c95e810
attach sources and javadocs to deploy
psiegman Oct 28, 2012
b47b283
Test to demonstrate that toc hrefs are should include the path of the…
Nov 15, 2012
60327e7
Correctly handle ncx hrefs when the toc file is not in the root.
Nov 15, 2012
b86d818
Merge pull request #35 from lukepfarrar/fix_toc_path_bug
psiegman Nov 19, 2012
c522b8c
Added OGG audio to recognized file types.
NightWhistler Mar 27, 2013
d7e6089
Merge pull request #39 from NightWhistler/to_upstream
psiegman Mar 27, 2013
e426e21
Added support for reading epub files directly from a java.zip.ZipFile…
maylencita Apr 4, 2013
7d1f6db
Small memory optimization.
NightWhistler May 1, 2013
95be381
Merge pull request #46 from NightWhistler/buffer_optimization
psiegman May 8, 2013
c91f5fd
Extra check
NightWhistler Jun 7, 2013
c2a38cf
Merge pull request #48 from NightWhistler/buffer_optimization
psiegman Jun 9, 2013
bfbc168
Adds support for ePubs with large resources that don't fit into memory.
veselinn May 15, 2012
3804fab
Otpimized the way the zip entry of a lazy loaded Resource is found in…
ttopalov Mar 14, 2013
c8d7db3
Merge pull request #49 from pparlev/master
psiegman Jun 30, 2013
8d15d5b
Added support for reading epub files directly from a java.zip.ZipFile…
maylencita Apr 4, 2013
d759eb0
Merge pull request #51 from NightWhistler/patch_on_patch
psiegman Jun 30, 2013
2a1eadf
Add sbt build file to project
maylencita Jul 11, 2013
b9ca34b
Complete sbt project file
maylencita Jul 16, 2013
5ef19ef
Metadata no longer has coverImage.
Sep 7, 2013
1ff5ad6
remove unused class
psiegman Sep 9, 2013
b81d5f6
refactoring and more testing
psiegman Sep 9, 2013
8b0cf39
attempt at making the github repo work again
psiegman Sep 9, 2013
430a164
Merge branch 'master' of https://github.com/psiegman/epublib
psiegman Sep 9, 2013
31c4c45
fix getting of meta attribute values
psiegman Sep 9, 2013
f97103c
add another test
psiegman Sep 9, 2013
2e64637
Merge branch 'master' of https://github.com/maylencita/epublib into m…
psiegman Sep 9, 2013
fc224da
Make images work in the viewer on Windows
psiegman Sep 9, 2013
c4c1578
Merge pull request #53 from DaveJarvis/patch-1
psiegman Sep 9, 2013
7b0dc81
removed commons-io dependency from epublib-core
psiegman Sep 9, 2013
a3434a5
fix the getting of TOC references
psiegman Sep 9, 2013
c150ccc
remove unused import
psiegman Sep 9, 2013
a061300
maven pom.xml reorganisation/cleanup
psiegman Sep 10, 2013
3eb9c13
javadoc fixes
psiegman Sep 10, 2013
8ce5db4
Also used ZipFile for lazy loading now.
NightWhistler Jul 25, 2013
6bf89aa
Merge pull request #55 from NightWhistler/performance_fix
psiegman Mar 9, 2014
91a2ebf
add function to CollectionUtil
psiegman Mar 17, 2014
df6a846
modernize unit test style
psiegman Mar 17, 2014
84a94a5
refactor the loading of resources
psiegman Mar 17, 2014
e7d409a
fix #33 enable the creation of a subclass of Book
psiegman Mar 17, 2014
aace705
use more modern style unit tests
psiegman Aug 9, 2014
707dfbf
add cleaned up version of jazzlib to make zipfile reading more resilient
psiegman Aug 10, 2014
108cecb
Use private copy of jazzlib instead of java.util.ZipInputStream
psiegman Aug 10, 2014
46bde1d
make javadoc work again with java 8
psiegman Aug 10, 2014
31d47e6
Update NCXDocument
sheepsskullcity Feb 23, 2015
84f2452
Merge pull request #81 from sheepsskullcity/master
psiegman Feb 23, 2015
e479ce1
resolves #86 by first looking for NCX resources by mime type instead …
Oct 12, 2015
02280cc
small cleanups
Oct 12, 2015
d1429b2
fix and improve sbt build
Oct 21, 2015
878bfdf
Merge pull request #87 from spider-mario/sbt
psiegman Oct 21, 2015
c7c088f
fix issue where an invalid package href can lead to the table of cont…
Oct 23, 2015
bcfba1b
add more unit tests
Oct 23, 2015
dd16d1c
Issue #93 read TOC references only once instead of twice
psiegman Jan 16, 2016
c3ef675
Fixes #94
psiegman Jan 20, 2016
d691a22
Fixes #95
psiegman Jan 21, 2016
875f974
Add usage info for Android to README
wbrawner Sep 19, 2018
40993f9
Merge pull request #118 from wbrawner/master
psiegman Sep 20, 2018
1bc36b1
writing/reading metadata other properties
ernesto-arm Nov 19, 2019
9c33d59
Create maven.yml
ernesto-arm Nov 19, 2019
6a215f8
Merge pull request #123 from ernesto-arm/master
psiegman Nov 19, 2019
f16440e
Refactor pom dependencies, upgrade plugin versions
psiegman Nov 27, 2019
60805cd
Add unit tests
psiegman Nov 27, 2019
491134b
Remove duplicate readme
psiegman Nov 27, 2019
f93201d
Add Travis-ci build support
psiegman Nov 27, 2019
b07bb56
Moving minimal required java version to 1.7, upgrading epublib versio…
psiegman Nov 27, 2019
1275337
Add tools readme
psiegman Nov 27, 2019
779bc00
Ignore javadoc errors on build
psiegman Nov 27, 2019
b8fb5dc
Fix travis-ci build
psiegman Nov 27, 2019
5107851
Set dist to trusty in travis.yml to try and make travis build work
psiegman Nov 27, 2019
40741ca
Do travis builds only on openjdk, and leave javadoc path empty to fix…
psiegman Nov 27, 2019
225aa23
Fixed <a href="https://github.com/psiegman/epublib/issues/122">Issue …
Dec 3, 2019
996a24a
Update ResourcesLoaderTest.java
faltiska Dec 3, 2019
d34224d
Update ResourcesLoaderTest.java
faltiska Dec 3, 2019
4a30a9c
Merge pull request #124 from faltiska/master
psiegman Dec 3, 2019
f5f89c9
Fix a few Javadoc issues.
christianhujer Dec 16, 2019
3993196
Merge pull request #126 from nelkinda/master
psiegman Dec 16, 2019
1946c7f
Updated readme to Point to Paul's page.
faltiska Apr 11, 2020
1bf7c00
Default language is now set to "undefined" so people can check if the…
faltiska Apr 11, 2020
e919b79
Modified readme again
faltiska Apr 11, 2020
cdf6fcd
Revert "Updated readme to Point to Paul's page."
faltiska Apr 11, 2020
0f5726b
Typo correction in README
MountainHills May 3, 2021
9405b62
Merge pull request #140 from MountainHills/patch-1
psiegman May 3, 2021
159f084
initial commit
chauf Sep 22, 2021
9ab7590
merged with upstream
chauf Sep 23, 2021
3ba961e
feat(EPUB3 Support) Add EPUB3 Support
chauf Sep 23, 2021
8b10c35
Fixed distribution management config
chauf Sep 23, 2021
493381e
Fixed issue with epubs3 that do have no ncx but only nav xhtml.
chauf Oct 6, 2021
d4ed9e6
Merge branch 'master' of https://github.com/psiegman/epublib
faltiska Aug 5, 2022
efac7b0
Merge branch 'add_epub3_support' of https://github.com/hauf-rakuten/e…
faltiska Aug 5, 2022
4ab745a
Made default language "und" again
faltiska Aug 5, 2022
3a4888e
Fixed a merge error
faltiska Aug 5, 2022
9bf412b
Removed dependency to slf4j because of several vulnerabilities.
faltiska Aug 6, 2022
814e32d
Fixed unit tests that were failing on windows because of the line ter…
faltiska Aug 6, 2022
d9f91c4
Fixed 2 errors:
faltiska Sep 30, 2022
f0e109b
Added ability to extract the TOC from a Nav resource if the NCX resou…
faltiska Jan 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ epublib-tools/.classpath
epublib-tools/.project
epublib-core/.settings
epublib-tools/.settings/
!/.idea/
*.iml
9 changes: 7 additions & 2 deletions epublib-core/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
Expand All @@ -15,11 +15,16 @@
<parent>
<groupId>nl.siegmann.epublib</groupId>
<artifactId>epublib-parent</artifactId>
<version>4.0</version>
<version>4.0.1-EPUB3-SNAPSHOT</version>
<relativePath>../epublib-parent/pom.xml</relativePath>
</parent>

<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>net.sf.kxml</groupId>
<artifactId>kxml2</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@ public class Author implements Serializable {

private String firstname;
private String lastname;
private Relator relator = Relator.AUTHOR;
private Relator relator;

public Scheme getScheme() {
return scheme;
}

public void setScheme(Scheme scheme) {
this.scheme = scheme;
}

private Scheme scheme;

public Author(String singleName) {
this("", singleName);
Expand Down
286 changes: 15 additions & 271 deletions epublib-core/src/main/java/nl/siegmann/epublib/domain/Book.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,9 @@ public class Identifier implements Serializable {
*
*/
private static final long serialVersionUID = 955949951416391810L;

public interface Scheme {
String UUID = "UUID";
String ISBN = "ISBN";
String URL = "URL";
String URI = "URI";
}

private boolean bookId = false;
private String scheme;
private Scheme scheme;
private String value;

/**
Expand All @@ -40,11 +33,19 @@ public Identifier() {
}


public Identifier(String scheme, String value) {
public Identifier(Scheme scheme, String value) {
this.scheme = scheme;
this.value = value;
}

public Scheme getScheme() {
return scheme;
}

public void setScheme(Scheme scheme) {
this.scheme = scheme;
}

/**
* The first identifier for which the bookId is true is made the bookId identifier.
* If no identifier has bookId == true then the first bookId identifier is written as the primary.
Expand Down Expand Up @@ -72,12 +73,6 @@ public static Identifier getBookIdIdentifier(List<Identifier> identifiers) {
return result;
}

public String getScheme() {
return scheme;
}
public void setScheme(String scheme) {
this.scheme = scheme;
}
public String getValue() {
return value;
}
Expand All @@ -104,19 +99,19 @@ public boolean isBookId() {
}

public int hashCode() {
return StringUtil.defaultIfNull(scheme).hashCode() ^ StringUtil.defaultIfNull(value).hashCode();
return StringUtil.defaultIfNull(scheme.getName()).hashCode() ^ StringUtil.defaultIfNull(value).hashCode();
}

public boolean equals(Object otherIdentifier) {
if(! (otherIdentifier instanceof Identifier)) {
return false;
}
return StringUtil.equals(scheme, ((Identifier) otherIdentifier).scheme)
return StringUtil.equals(scheme.getName(), ((Identifier) otherIdentifier).scheme.getName())
&& StringUtil.equals(value, ((Identifier) otherIdentifier).value);
}

public String toString() {
if (StringUtil.isBlank(scheme)) {
if (StringUtil.isBlank(scheme.getName())) {
return "" + value;
}
return "" + scheme + ":" + value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

import nl.siegmann.epublib.service.MediatypeService;
import nl.siegmann.epublib.util.IOUtil;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* A Resource that loads its data only on-demand.
* This way larger books can fit into memory and can be opened faster.
Expand All @@ -28,7 +27,7 @@ public class LazyResource extends Resource {
private String filename;
private long cachedSize;

private static final Logger LOG = LoggerFactory.getLogger(LazyResource.class);
private static final Logger LOG = Logger.getLogger(LazyResource.class.getName());

/**
* Creates a Lazy resource, by not actually loading the data for this entry.
Expand Down Expand Up @@ -102,8 +101,9 @@ public void initialize() throws IOException {
public byte[] getData() throws IOException {

if ( data == null ) {

LOG.debug("Initializing lazy resource " + filename + "#" + this.getHref() );
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Initializing lazy resource " + filename + "#" + this.getHref());
}

InputStream in = getResourceStream();
byte[] readData = IOUtil.toByteArray(in, (int) this.cachedSize);
Expand Down
24 changes: 14 additions & 10 deletions epublib-core/src/main/java/nl/siegmann/epublib/domain/Metadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ public class Metadata implements Serializable {
*/
private static final long serialVersionUID = -2437262888962149444L;

public static final String DEFAULT_LANGUAGE = "en";
/**
* Default language is now set to "undefined" so people can check if the epub declares a language.
* They may want to try and detect the language based on the book text if there's no language metadata.
*/
public static final String DEFAULT_LANGUAGE = "und";

private boolean autoGeneratedId = true;
private List<Author> authors = new ArrayList<Author>();
Expand All @@ -34,7 +38,7 @@ public class Metadata implements Serializable {
private String language = DEFAULT_LANGUAGE;
private Map<QName, String> otherProperties = new HashMap<QName, String>();
private List<String> rights = new ArrayList<String>();
private List<String> titles = new ArrayList<String>();
private List<Title> titles = new ArrayList<>();
private List<Identifier> identifiers = new ArrayList<Identifier>();
private List<String> subjects = new ArrayList<String>();
private String format = MediatypeService.EPUB.getName();
Expand Down Expand Up @@ -126,27 +130,27 @@ public List<String> getRights() {
*
* @return the first non-blank title of the book.
*/
public String getFirstTitle() {
public Title getFirstTitle() {
if (titles == null || titles.isEmpty()) {
return "";
return Title.EMPTY;
}
for (String title: titles) {
if (StringUtil.isNotBlank(title)) {
for (Title title: titles) {
if (StringUtil.isNotBlank(title.value)) {
return title;
}
}
return "";
return Title.EMPTY;
}


public String addTitle(String title) {
public Title addTitle(Title title) {
this.titles.add(title);
return title;
}
public void setTitles(List<String> titles) {
public void setTitles(List<Title> titles) {
this.titles = titles;
}
public List<String> getTitles() {
public List<Title> getTitles() {
return titles;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package nl.siegmann.epublib.domain;

import java.io.IOException;

public class OpfResource extends Resource {

public static final String DEFAULT_VERSION = "2.0";

private String version;

private String prefix;

public OpfResource(Resource resource) throws IOException {
super(
resource.getId(),
resource.getData(),
resource.getHref(),
resource.getMediaType(),
resource.getInputEncoding()
);
}

public String getVersion() {
return version;
}

public void setVersion(String version) {
this.version = version;
}

public String getPrefix() {
return prefix;
}

public void setPrefix(String prefix) {
this.prefix = prefix;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ public class Resource implements Serializable {
private MediaType mediaType;
private String inputEncoding = Constants.CHARACTER_ENCODING;
protected byte[] data;

private boolean isNav;
private boolean containingSvg;
private boolean isScripted;

/**
* Creates an empty Resource with the given href.
*
Expand Down Expand Up @@ -137,6 +140,30 @@ public Resource(String id, byte[] data, String href, MediaType mediaType, String
this.inputEncoding = inputEncoding;
this.data = data;
}

public boolean isNav() {
return isNav;
}

public void setNav(boolean nav) {
isNav = nav;
}

public boolean isContainingSvg() {
return containingSvg;
}

public void setContainingSvg(boolean containingSvg) {
this.containingSvg = containingSvg;
}

public boolean isScripted() {
return isScripted;
}

public void setScripted(boolean scripted) {
isScripted = scripted;
}

/**
* Gets the contents of the Resource as an InputStream.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,19 @@ public class Resources implements Serializable {
private static final String IMAGE_PREFIX = "image_";
private static final String ITEM_PREFIX = "item_";
private int lastId = 1;

private Resource navResource;

private Map<String, Resource> resources = new HashMap<String, Resource>();


public Resource getNavResource() {
return navResource;
}

public void setNavResource(Resource navResource) {
this.navResource = navResource;
}


/**
* Adds a resource to the resources.
*
Expand Down
36 changes: 36 additions & 0 deletions epublib-core/src/main/java/nl/siegmann/epublib/domain/Scheme.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package nl.siegmann.epublib.domain;

public class Scheme {

public final static Scheme UUID = new Scheme("UUID");

public final static Scheme ISBN = new Scheme("ISBN");

private String name;
private String value;

public Scheme(String name) {
this.name = name;
}

public Scheme(String name, String value) {
this.name = name;
this.value = value;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}
}
Loading