Commit d0e7ab7b authored by Ole Streicher's avatar Ole Streicher

Rediff patches

Drop Use-latest-nom.tam.fits-API.patch: <REASON>
parent a384641c
From: Ole Streicher <olebole@debian.org>
Date: Mon, 20 Feb 2017 13:28:16 +0100
Subject: Use latest nom.tam.fits API
Unfortunately, nom.tam.fits (at least until release 1.15.1) re-orders
the header before writing, so that they conform to FITS version 2.
Specifically this puts the `EXTEND` header directly after the `NAXIS*`
headers.
The FITS-PLUS format created in starjava-votable however requires
additional keywords between `NAXIS*` and `EXTEND`. This is a bit
unfortunate, unflexible, and violated the FITS standard when the
FITS-PLUS format was created, but since FITS version 3 the keyword
order does not matter anymore. So, this patch also includes an
alternative `nom.tam.fits.HeaderOrder` class that leaves the order as
it is. This is also the current proposal on the according nom-tam-fits
pull request:
https://github.com/nom-tam-fits/nom-tam-fits/issues/114
Depending on the result of the PR, this patch may be simplified.
---
.../uk/ac/starlink/fits/AbstractArrayDataIO.java | 4 ++++
src/main/uk/ac/starlink/fits/AbstractWideFits.java | 1 +
src/main/uk/ac/starlink/fits/FitsConstants.java | 6 +++---
src/main/uk/ac/starlink/fits/MappedFile.java | 20 ++++++++++++++++++++
src/main/uk/ac/starlink/fits/MultiMappedFile.java | 20 ++++++++++++++++++++
.../uk/ac/starlink/fits/WritableFitsArrayImpl.java | 2 +-
6 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/src/main/uk/ac/starlink/fits/AbstractArrayDataIO.java b/src/main/uk/ac/starlink/fits/AbstractArrayDataIO.java
index 24065f6..8b81173 100644
--- a/src/main/uk/ac/starlink/fits/AbstractArrayDataIO.java
+++ b/src/main/uk/ac/starlink/fits/AbstractArrayDataIO.java
@@ -314,6 +314,10 @@ public abstract class AbstractArrayDataIO
return primitiveArrayRecurse( o, nread );
}
+ public long readLArray( Object o ) throws IOException {
+ return readArray( o );
+ }
+
private int primitiveArrayRecurse( Object o, int nread )
throws IOException {
if ( o == null ) {
diff --git a/src/main/uk/ac/starlink/fits/AbstractWideFits.java b/src/main/uk/ac/starlink/fits/AbstractWideFits.java
index 4a5ac4a..415bdae 100644
--- a/src/main/uk/ac/starlink/fits/AbstractWideFits.java
+++ b/src/main/uk/ac/starlink/fits/AbstractWideFits.java
@@ -375,6 +375,7 @@ public abstract class AbstractWideFits implements WideFits {
* @param isRead true for read, false for write
*/
private void checkHasHierarch( boolean isRead ) {
+ FitsFactory.setUseHierarch( true );
if ( ! FitsFactory.getUseHierarch() ) {
logger_.severe( "FitsFactory.useHierarch=false: "
+ "HIERARCH-based wide FITS table convention "
diff --git a/src/main/uk/ac/starlink/fits/FitsConstants.java b/src/main/uk/ac/starlink/fits/FitsConstants.java
index aa59778..dd6db47 100644
--- a/src/main/uk/ac/starlink/fits/FitsConstants.java
+++ b/src/main/uk/ac/starlink/fits/FitsConstants.java
@@ -42,7 +42,7 @@ public class FitsConstants {
public static final String NDARRAY_PREFIX = "NDA_";
/** Image of end-of-header card. */
- public static final HeaderCard END_CARD = new HeaderCard(
+ public static final HeaderCard END_CARD = HeaderCard.create(
"END " +
" " );
@@ -228,7 +228,7 @@ public class FitsConstants {
while ( need > 0 ) {
int len = strm.read( buffer, 80 - need, need );
if ( len <= 0 ) {
- throw new TruncatedFileException();
+ throw new TruncatedFileException("File truncated");
}
need -= len;
}
@@ -242,7 +242,7 @@ public class FitsConstants {
}
String cbuf = new String( buffer );
- HeaderCard fcard = new HeaderCard( cbuf );
+ HeaderCard fcard = HeaderCard.create( cbuf );
if ( firstCard ) {
String key = fcard.getKey();
if ( key == null ||
diff --git a/src/main/uk/ac/starlink/fits/MappedFile.java b/src/main/uk/ac/starlink/fits/MappedFile.java
index 3116315..df8553d 100644
--- a/src/main/uk/ac/starlink/fits/MappedFile.java
+++ b/src/main/uk/ac/starlink/fits/MappedFile.java
@@ -106,6 +106,14 @@ public class MappedFile extends AbstractArrayDataIO implements RandomAccess {
return (long) niobuf_.position();
}
+ public void skipAllBytes( long toSkip ) {
+ skipBytes((int)toSkip);
+ }
+
+ public void skipAllBytes( int toSkip ) {
+ skipBytes(toSkip);
+ }
+
public int skipBytes( int toSkip ) {
int nskip = Math.max( toSkip, 0 );
nskip = Math.min( toSkip, niobuf_.remaining() );
@@ -169,6 +177,18 @@ public class MappedFile extends AbstractArrayDataIO implements RandomAccess {
}
}
+ public boolean markSupported() {
+ return false;
+ }
+
+ public void reset() throws IOException {
+ throw new IOException( "mark/reset not supported" );
+ }
+
+ public void mark( int i ) {
+ // no action
+ }
+
/**
* Returns a mapped byte buffer which results from mapping a given file.
*
diff --git a/src/main/uk/ac/starlink/fits/MultiMappedFile.java b/src/main/uk/ac/starlink/fits/MultiMappedFile.java
index 6d9a3cd..421bf09 100644
--- a/src/main/uk/ac/starlink/fits/MultiMappedFile.java
+++ b/src/main/uk/ac/starlink/fits/MultiMappedFile.java
@@ -101,6 +101,14 @@ public class MultiMappedFile extends AbstractArrayDataIO
}
}
+ public void skipAllBytes( long toSkip ) throws IOException {
+ skipBytes((int)toSkip);
+ }
+
+ public void skipAllBytes( int toSkip ) throws IOException {
+ skipBytes(toSkip);
+ }
+
public int skipBytes( int toSkip ) throws IOException {
return toInt( skip( (long) toSkip ) );
};
@@ -193,6 +201,18 @@ public class MultiMappedFile extends AbstractArrayDataIO
}
}
+ public boolean markSupported() {
+ return false;
+ }
+
+ public void reset() throws IOException {
+ throw new IOException( "mark/reset not supported" );
+ }
+
+ public void mark( int i ) {
+ // no action
+ }
+
/**
* Returns the MappedByteBuffer corresponding to a given block of this
* file. The relevant region of the file is mapped (lazily) if
diff --git a/src/main/uk/ac/starlink/fits/WritableFitsArrayImpl.java b/src/main/uk/ac/starlink/fits/WritableFitsArrayImpl.java
index 33ffaee..38603cd 100644
--- a/src/main/uk/ac/starlink/fits/WritableFitsArrayImpl.java
+++ b/src/main/uk/ac/starlink/fits/WritableFitsArrayImpl.java
@@ -153,7 +153,7 @@ class WritableFitsArrayImpl implements ArrayImpl {
}
/* Add termination record. */
- cardlist.add( new HeaderCard( "END" ) );
+ cardlist.add( HeaderCard.create( "END" ) );
}
catch( HeaderCardException e ) {
throw (IOException) new IOException( e.getMessage() )
Remove-NDX-and-JNIAST-references.patch
Fix-build.xml-for-use-outside-of-starjava.patch
Use-latest-nom.tam.fits-API.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment