Skip to content

Commit

Permalink
Merge pull request #1 from openpreserve/feat/opf-lib
Browse files Browse the repository at this point in the history
FEAT: JHOVE ready TIFF library
  • Loading branch information
carlwilson authored Jul 8, 2020
2 parents 682605d + 7a2976c commit e3d6e24
Show file tree
Hide file tree
Showing 6 changed files with 264 additions and 118 deletions.
18 changes: 15 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
language: java

install: mvn install -Dgpg.skip=true
dist: trusty
sudo: required

language: java
jdk:
- openjdk8
- oraclejdk8

branches:
except:
- "/^v|d\\d+\\.\\d+\\.\\d+$/"
- "/^jenkins-jhove-v|d\\d+\\.\\d+\\.\\d+$/"

install: mvn clean package

before_install:
- sudo apt-get install -y jq
- wget -O ~/codacy-coverage-reporter-assembly-latest.jar http://resources.openpreservation.org/codacy-coverage-reporter-assembly-latest.jar
269 changes: 159 additions & 110 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.easyinnova</groupId>
<groupId>org.openpreservation</groupId>
<artifactId>tifflibrary4java</artifactId>
<version>1.9.7</version>
<version>1.9.8</version>
<packaging>jar</packaging>
<name>Tiff Library 4 Java</name>
<description>A library to read and give access to Tiff files.</description>
<url>https://github.com/easyinnova/Tiff-Library-4J/</url>
<url>https://github.com/openpreserve/Tiff-Library-4J.git/</url>
<inceptionYear>2015</inceptionYear>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -27,12 +27,27 @@
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>Carl Wilson</name>
<email>carl@openpreservation.org</email>
<organization>Open Preservation Foundation</organization>
<organizationUrl>https://openpreservation.org/</organizationUrl>
</developer>
<developer>
<name>Víctor Muñoz Solà</name>
<email>victormunoz@easyinnova.com</email>
<organization>Easy Innova</organization>
<organizationUrl>http://www.easyinnova.com</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git@github.com:openpreserve/Tiff-Library-4J.git</connection>
<developerConnection>scm:git:git@github.com:openpreserve/Tiff-Library-4J.git</developerConnection>
<url>git@github.com:openpreserve/Tiff-Library-4J.git</url>
</scm>

<dependencies>
<!--<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
Expand All @@ -54,30 +69,6 @@
<version>1.0.0</version>
</dependency>
</dependencies>
<developers>
<developer>
<name>Víctor Muñoz Solà</name>
<email>victormunoz@easyinnova.com</email>
<organization>Easy Innova</organization>
<organizationUrl>http://www.easyinnova.com</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git@github.com:easyinnova/Tiff-Library-4J.git</connection>
<developerConnection>scm:git:git@github.com:easyinnova/Tiff-Library-4J.git
</developerConnection>
<url>git@github.com:easyinnova/Tiff-Library-4J.git</url>
</scm>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<build>

Expand All @@ -97,7 +88,6 @@
</pluginManagement>

<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand All @@ -107,89 +97,148 @@
<target>1.8</target>
</configuration>
</plugin>

<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

<profiles>
<profiles>
<profile>
<id>license-header</id>
<build>
<plugins>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<configuration>
<header>license/template/license.txt</header>
<properties>
<owner>veraPDF Consortium</owner>
<email>info@verapdf.org</email>
</properties>
<excludes>
<exclude>license/template/**</exclude>
<exclude>src/test/resources/**</exclude>
<exclude>src/main/resources/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>

<!-- Sign + JavaDoc-->
<profile>
<id>no-local</id>
<activation>
<property>
<name>!local</name>
</property>
</activation>
<build>
<plugins>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<goals>deploy</goals>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<stylesheetfile>${basedir}/stylesheet.css</stylesheetfile>
<docfilessubdirs>true</docfilessubdirs>
<links>
<link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
</links>
<sourcepath>${basedir}/src</sourcepath>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<profile>
<id>ossrh</id>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<profile>
<id>opf</id>
<distributionManagement>
<snapshotRepository>
<id>opf-artefactory</id>
<url>https://artifactory.openpreservation.org/artifactory/vera-dev-local/</url>
</snapshotRepository>
<repository>
<id>opf-artefactory</id>
<url>https://artifactory.openpreservation.org/artifactory/vera-dev-local/</url>
</repository>
</distributionManagement>
</profile>

</plugins>
</build>
</profile>
</profiles>
</profiles>

</project>
12 changes: 12 additions & 0 deletions src/main/java/com/easyinnova/tiff/io/MappedByteInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.lang.reflect.Method;
import java.nio.BufferUnderflowException;
import java.nio.MappedByteBuffer;
Expand Down Expand Up @@ -66,6 +67,17 @@ public MappedByteInputStream(File file) throws FileNotFoundException {
}
}

public MappedByteInputStream(RandomAccessFile raf) throws FileNotFoundException {
path = "";
ch = raf.getChannel();
try {
mbsize = ch.size();
mb = ch.map(FileChannel.MapMode.READ_ONLY, 0L, mbsize);
} catch (Exception ex) {
ex.printStackTrace();
}
}

public String getPath() {
return path;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ public RandomAccessFileInputStream(File file) throws FileNotFoundException {
randomAccessFile = new RandomAccessFile(file, "r");
}

public RandomAccessFileInputStream(final RandomAccessFile raf) throws FileNotFoundException {
this(raf, "");
}

public RandomAccessFileInputStream(final RandomAccessFile raf, final String path) throws FileNotFoundException {
this.path = path;
this.randomAccessFile = raf;
}

public String getPath() {
return path;
}
Expand Down
Loading

0 comments on commit e3d6e24

Please sign in to comment.