[med-svn] [beagle] 02/04: Imported Upstream version 4.1~160222-8ef+dfsg

Dylan Aïssi bob.dybian-guest at moszumanska.debian.org
Mon Apr 11 05:41:04 UTC 2016


This is an automated email from the git hooks/post-receive script.

bob.dybian-guest pushed a commit to branch master
in repository beagle.

commit 7ef25aa2604817e9a5b671744a90d64f3772439b
Author: Dylan Aïssi <bob.dybian at gmail.com>
Date:   Sun Apr 10 15:20:28 2016 +0200

    Imported Upstream version 4.1~160222-8ef+dfsg
---
 net/sf/samtools/Defaults.java                      |  49 --
 net/sf/samtools/FileTruncatedException.java        |  46 --
 net/sf/samtools/SAMException.java                  |  44 --
 net/sf/samtools/SAMFormatException.java            |  44 --
 net/sf/samtools/util/BinaryCodec.java              | 662 ---------------------
 .../util/BlockCompressedFilePointerUtil.java       | 101 ----
 .../samtools/util/BlockCompressedInputStream.java  | 484 ---------------
 .../samtools/util/BlockCompressedOutputStream.java | 312 ----------
 .../util/BlockCompressedStreamConstants.java       | 118 ----
 net/sf/samtools/util/BlockGunzipper.java           | 115 ----
 net/sf/samtools/util/HttpUtils.java                | 102 ----
 net/sf/samtools/util/IOUtil.java                   | 124 ----
 net/sf/samtools/util/RuntimeEOFException.java      |  46 --
 net/sf/samtools/util/RuntimeIOException.java       |  46 --
 net/sf/samtools/util/SeekableBufferedStream.java   |  90 ---
 net/sf/samtools/util/SeekableFileStream.java       |  69 ---
 net/sf/samtools/util/SeekableHTTPStream.java       | 153 -----
 net/sf/samtools/util/SeekableStream.java           |  37 --
 net/sf/samtools/util/StringUtil.java               | 460 --------------
 19 files changed, 3102 deletions(-)

diff --git a/net/sf/samtools/Defaults.java b/net/sf/samtools/Defaults.java
deleted file mode 100644
index 4c3a652..0000000
--- a/net/sf/samtools/Defaults.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package net.sf.samtools;
-
-/**
- * Embodies defaults for global values that affect how the SAM JDK operates. Defaults are encoded in the class
- * and are also overridable using system properties.
- *
- * @author Tim Fennell
- */
-public class Defaults {
-    /** Should BAM index files be created when writing out coordinate sorted BAM files?  Default = false. */
-    public static final boolean CREATE_INDEX;
-
-    /** Should MD5 files be created when writing out SAM and BAM files?  Default = false. */
-    public static final boolean CREATE_MD5;
-
-    /** Should asynchronous I/O be used when writing out SAM and BAM files (one thread per file).  Default = false. */
-    public static final boolean USE_ASYNC_IO;
-
-    /** Compresion level to be used for writing BAM and other block-compressed outputs.  Default = 5. */
-    public static final int COMPRESSION_LEVEL;
-
-    /** Buffer size, in bytes, used whenever reading/writing files or streams.  Default = 128k. */
-    public static final int BUFFER_SIZE;
-
-    static {
-        CREATE_INDEX      = getBooleanProperty("create_index", false);
-        CREATE_MD5        = getBooleanProperty("create_md5", false);
-        USE_ASYNC_IO      = getBooleanProperty("use_async_io", false);
-        COMPRESSION_LEVEL = getIntProperty("compression_level", 5);
-        BUFFER_SIZE       = getIntProperty("buffer_size", 1024 * 128);
-    }
-
-    /** Gets a string system property, prefixed with "samjdk." using the default if the property does not exist.*/
-    private static String getStringProperty(final String name, final String def) {
-        return System.getProperty("samjdk." + name, def);
-    }
-
-    /** Gets a boolean system property, prefixed with "samjdk." using the default if the property does not exist.*/
-    private static boolean getBooleanProperty(final String name, final boolean def) {
-        final String value = getStringProperty(name, new Boolean(def).toString());
-        return Boolean.parseBoolean(value);
-    }
-
-    /** Gets an int system property, prefixed with "samjdk." using the default if the property does not exist.*/
-    private static int getIntProperty(final String name, final int def) {
-        final String value = getStringProperty(name, new Integer(def).toString());
-        return Integer.parseInt(value);
-    }
-}
diff --git a/net/sf/samtools/FileTruncatedException.java b/net/sf/samtools/FileTruncatedException.java
deleted file mode 100644
index 0c04cee..0000000
--- a/net/sf/samtools/FileTruncatedException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2009 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package net.sf.samtools;
-
-/**
- * Thrown when it is possible to detect that a SAM or BAM file is truncated.
- *
- * @author alecw at broadinstitute.org
- */
-public class FileTruncatedException extends SAMException {
-    public FileTruncatedException() {
-    }
-
-    public FileTruncatedException(final String s) {
-        super(s);
-    }
-
-    public FileTruncatedException(final String s, final Throwable throwable) {
-        super(s, throwable);
-    }
-
-    public FileTruncatedException(final Throwable throwable) {
-        super(throwable);
-    }
-}
diff --git a/net/sf/samtools/SAMException.java b/net/sf/samtools/SAMException.java
deleted file mode 100644
index 8ec29c5..0000000
--- a/net/sf/samtools/SAMException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2009 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package net.sf.samtools;
-
-/**
- * @author alecw at broadinstitute.org
- */
-public class SAMException extends RuntimeException {
-    public SAMException() {
-    }
-
-    public SAMException(final String s) {
-        super(s);
-    }
-
-    public SAMException(final String s, final Throwable throwable) {
-        super(s, throwable);
-    }
-
-    public SAMException(final Throwable throwable) {
-        super(throwable);
-    }
-}
diff --git a/net/sf/samtools/SAMFormatException.java b/net/sf/samtools/SAMFormatException.java
deleted file mode 100644
index 1ae70fd..0000000
--- a/net/sf/samtools/SAMFormatException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2009 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package net.sf.samtools;
-
-/**
- * Thrown when a SAM file being read or decoded (text or binary) looks bad.
- */
-public class SAMFormatException extends SAMException {
-    public SAMFormatException() {
-    }
-
-    public SAMFormatException(final String s) {
-        super(s);
-    }
-
-    public SAMFormatException(final String s, final Throwable throwable) {
-        super(s, throwable);
-    }
-
-    public SAMFormatException(final Throwable throwable) {
-        super(throwable);
-    }
-}
diff --git a/net/sf/samtools/util/BinaryCodec.java b/net/sf/samtools/util/BinaryCodec.java
deleted file mode 100644
index abffcbe..0000000
--- a/net/sf/samtools/util/BinaryCodec.java
+++ /dev/null
@@ -1,662 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2009 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package net.sf.samtools.util;
-
-import java.io.*;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * Encapsulates file representation of various primitive data types.  Forces little-endian disk representation.
- * Note that this class is currently not very efficient.  There are plans to increase the size of the ByteBuffer,
- * and move data between the ByteBuffer and the underlying input or output stream in larger chunks.
- *
- * All the read methods throw RuntimeEOFException if the input stream is exhausted before the required number
- * of bytes are read.
- *
- * @author Dave Tefft
- */
-public class BinaryCodec {
-
-    //Outstream to write to
-    private OutputStream outputStream;
-    //If a file or filename was given it will be stored here.  Used for error reporting.
-    private String outputFileName;
-
-    //Input stream to read from
-    private InputStream inputStream;
-    //If a file or filename was give to read from it will be stored here.  Used for error reporting.
-    private String inputFileName;
-
-    /*
-    Mode that the BinaryCodec is in.  It is either writing to a binary file or reading from.
-    This is set to true if it is writing to a binary file
-    Right now we don't support reading and writing to the same file with the same BinaryCodec instance
-    */
-    private boolean isWriting;
-
-    /**
-     * For byte swapping.
-     */
-    private ByteBuffer byteBuffer;
-
-    /**
-     * For reading Strings of known length, this can reduce object creation
-     */
-    private final byte[] scratchBuffer = new byte[16];
-
-    // Byte order used in BAM files.
-    private static final ByteOrder LITTLE_ENDIAN = ByteOrder.LITTLE_ENDIAN;
-    private static final byte NULL_BYTE[] = {0};
-
-    private static final long MAX_UBYTE = (Byte.MAX_VALUE * 2) + 1;
-    private static final long MAX_USHORT = (Short.MAX_VALUE * 2) + 1;
-    private static final long MAX_UINT = ((long)Integer.MAX_VALUE * 2) + 1;
-
-    // We never serialize more than this much at a time (except for Strings)
-    private static final int MAX_BYTE_BUFFER = 8;
-
-    //////////////////////////////////////////////////
-    // Constructors                                 //
-    //////////////////////////////////////////////////
-
-    /**
-     * Constructs BinaryCodec from a file and set it's mode to writing or not
-     *
-     * @param file    file to be written to or read from
-     * @param writing whether the file is being written to
-     */
-    public BinaryCodec(final File file, final boolean writing) {
-        this();
-        try {
-            this.isWriting = writing;
-            if (this.isWriting) {
-                this.outputStream = new FileOutputStream(file);
-                this.outputFileName = file.getName();
-            } else {
-                this.inputStream = new FileInputStream(file);
-                this.inputFileName = file.getName();
-            }
-        } catch (FileNotFoundException e) {
-            throw new RuntimeIOException("File not found: " + file, e);
-        }
-    }
-
-    /**
-     * Constructs BinaryCodec from a file name and set it's mode to writing or not
-     *
-     * @param fileName name of the file to be written to or read from
-     * @param writing  writing whether the file is being written to
-     */
-    public BinaryCodec(final String fileName, final boolean writing) {
-        this(new File(fileName), writing);
-    }
-
-    /**
-     * Constructs BinaryCodec from an output stream
-     *
-     * @param outputStream Stream to write to, since it's an output stream we know that isWriting
-     *                     should be set to true
-     */
-    public BinaryCodec(final OutputStream outputStream) {
-        this();
-        setOutputStream(outputStream);
-    }
-
-    /**
-     * Constructs BinaryCodec from an input stream
-     *
-     * @param inputStream Stream to read from, since we are reading isWriting is set to false
-     */
-    public BinaryCodec(final InputStream inputStream) {
-        this();
-        setInputStream(inputStream);
-    }
-
-    /**
-     * Ambiguous whether reading or writing until set{In,Out}putStream is called
-     */
-    public BinaryCodec() {
-        initByteBuffer();
-    }
-
-    /**
-     * Shared among ctors.
-     * Note that if endianness is changed, all the unsigned methods must also be changed.
-     */
-    private void initByteBuffer() {
-        byteBuffer = ByteBuffer.allocate(MAX_BYTE_BUFFER);
-        byteBuffer.order(LITTLE_ENDIAN);
-    }
-
-    //////////////////////////////////////////////////
-    // Writing methods                              //
-    //////////////////////////////////////////////////
-
-
-    /**
-     * Write whatever has been put into the byte buffer
-     * @param numBytes -- how much to write.  Note that in case of writing an unsigned value,
-     * more bytes were put into the ByteBuffer than will get written out.
-     */
-    private void writeByteBuffer(final int numBytes) {
-        assert(numBytes <= byteBuffer.limit());
-        writeBytes(byteBuffer.array(), 0, numBytes);
-    }
-
-    /**
-     * Writes a byte to the output buffer
-     *
-     * @param bite byte array to write
-     */
-    public void writeByte(final byte bite) {
-        byteBuffer.clear();
-        byteBuffer.put(bite);
-        writeByteBuffer(1);
-    }
-
-    public void writeByte(final int b) {
-        writeByte((byte)b);
-    }
-
-    /**
-     * Writes a byte array to the output buffer
-     *
-     * @param bytes value to write
-     */
-    public void writeBytes(final byte[] bytes) {
-        writeBytes(bytes,  0, bytes.length);
-    }
-
-    public void writeBytes(final byte[] bytes, final int startOffset, final int numBytes) {
-        if (!isWriting) {
-            throw new IllegalStateException("Calling write method on BinaryCodec open for read.");
-        }
-        try {
-            outputStream.write(bytes, startOffset, numBytes);
-        } catch (IOException e) {
-            throw new RuntimeIOException(constructErrorMessage("Write error"), e);
-        }
-    }
-
-    /**
-     * Write a 32-bit int to the output stream
-     *
-     * @param value int to write
-     */
-    public void writeInt(final int value) {
-        byteBuffer.clear();
-        byteBuffer.putInt(value);
-        writeByteBuffer(4);
-    }
-
-    /**
-     * Write a double (8 bytes) to the output stream
-     *
-     * @param value double to write
-     */
-    public void writeDouble(final double value) {
-        byteBuffer.clear();
-        byteBuffer.putDouble(value);
-        writeByteBuffer(8);
-    }
-
-    /**
-     * Write a 64-bit long to the output stream
-     *
-     * @param value long to write
-     */
-    public void writeLong(final long value) {
-        byteBuffer.clear();
-        byteBuffer.putLong(value);
-        writeByteBuffer(8);
-    }
-
-
-    /**
-     * Write a 16-bit short to output stream
-     */
-    public void writeShort(final short value) {
-        byteBuffer.clear();
-        byteBuffer.putShort(value);
-        writeByteBuffer(2);
-    }
-
-    /**
-     * Write a float (4 bytes) to the output stream
-     *
-     * @param value float to write
-     */
-    public void writeFloat(final float value) {
-        byteBuffer.clear();
-        byteBuffer.putFloat(value);
-        writeByteBuffer(4);
-    }
-
-    /**
-     * Writes a boolean (1 byte) to the output buffer
-     *
-     * @param value boolean to write
-     */
-    public void writeBoolean(final boolean value) {
-        byteBuffer.clear();
-        byteBuffer.put(value ? (byte)1 : (byte)0);
-        writeByteBuffer(1);
-    }
-
-    /**
-     * Writes a string to the buffer as ASCII bytes
-     *
-     * @param value       string to write to buffer
-     * @param writeLength prefix the string with the length as a 32-bit int
-     * @param appendNull  add a null byte to the end of the string
-     */
-    public void writeString(final String value, final boolean writeLength, final boolean appendNull) {
-        if (writeLength) {
-            int lengthToWrite = value.length();
-            if (appendNull) lengthToWrite++;
-            writeInt(lengthToWrite);
-        }
-
-        //Actually writes the string to a buffer
-        writeString(value);
-
-        if (appendNull) writeBytes(NULL_BYTE);
-
-    }
-
-
-    /**
-     * Write a string to the buffer as ASCII bytes
-     *
-     * @param value string to write
-     */
-    private void writeString(final String value) {
-        writeBytes(StringUtil.stringToBytes(value));
-    }
-
-    /**
-     * Write an 8-bit unsigned byte.
-     * NOTE: This method will break if we change to big-endian.
-     */
-    public void writeUByte(final short val) {
-        if (val < 0) {
-            throw new IllegalArgumentException("Negative value (" + val + ") passed to unsigned writing method.");
-        }
-        if (val > MAX_UBYTE) {
-            throw new IllegalArgumentException("Value (" + val + ") to large to be written as ubyte.");
-        }
-        byteBuffer.clear();
-        byteBuffer.putShort(val);
-        writeByteBuffer(1);
-    }
-
-    /**
-     * Write a 16-bit unsigned short.
-     * NOTE: This method will break if we change to big-endian.
-     */
-    public void writeUShort(final int val) {
-        if (val < 0) {
-            throw new IllegalArgumentException("Negative value (" + val + ") passed to unsigned writing method.");
-        }
-        if (val > MAX_USHORT) {
-            throw new IllegalArgumentException("Value (" + val + ") to large to be written as ushort.");
-        }
-        byteBuffer.clear();
-        byteBuffer.putInt(val);
-        writeByteBuffer(2);
-    }
-
-    /**
-     * Write a 32-bit unsigned int.
-     * NOTE: This method will break if we change to big-endian.
-     */
-    public void writeUInt(final long val) {
-        if (val < 0) {
-            throw new IllegalArgumentException("Negative value (" + val + ") passed to unsigned writing method.");
-        }
-        if (val > MAX_UINT) {
-            throw new IllegalArgumentException("Value (" + val + ") to large to be written as uint.");
-        }
-        byteBuffer.clear();
-        byteBuffer.putLong(val);
-        writeByteBuffer(4);
-    }
-
-    //////////////////////////////////////////////////
-    // Reading methods                              //
-    //////////////////////////////////////////////////
-
-    /**
-     * Read a byte array from the input stream.
-     *
-     * @throws net.sf.samtools.util.RuntimeEOFException if fewer than buffer.length bytes to read
-     */
-    public void readBytes(final byte[] buffer) {
-        readBytes(buffer, 0, buffer.length);
-    }
-
-    /**
-     * Read a byte array from the input stream
-     *
-     * @param buffer where to put bytes read
-     * @param offset offset to start putting bytes into buffer
-     * @param length number of bytes to read
-     * @throws RuntimeEOFException if fewer than length bytes to read
-     */
-    public void readBytes(final byte[] buffer, final int offset, final int length) {
-        int totalNumRead = 0;
-        do {
-            final int numRead = readBytesOrFewer(buffer, offset + totalNumRead, length - totalNumRead);
-            if (numRead < 0) {
-                throw new RuntimeEOFException(constructErrorMessage("Premature EOF"));
-            } else {
-                totalNumRead += numRead;
-            }
-        } while (totalNumRead < length);
-    }
-
-    /**
-     * Reads a byte array from the input stream.
-     *
-     * @param buffer where to put bytes read
-     * @param offset offset to start putting bytes into buffer
-     * @param length number of bytes to read.  Fewer bytes may be read if EOF is reached before length bytes
-     *        have been read.
-     * @return the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
-     */
-    public int readBytesOrFewer(final byte[] buffer, final int offset, final int length) {
-        if (isWriting) {
-            throw new IllegalStateException("Calling read method on BinaryCodec open for write.");
-        }
-        try {
-            return inputStream.read(buffer, offset, length);
-        } catch (IOException e) {
-            throw new RuntimeIOException(constructErrorMessage("Read error"), e);
-        }
-    }
-
-    /**
-     * @return a single byte read from the input stream.
-     */
-    public byte readByte() {
-        if (isWriting) {
-            throw new IllegalStateException("Calling read method on BinaryCodec open for write.");
-        }
-        try {
-            final int ret = inputStream.read();
-            if (ret == -1) {
-                throw new RuntimeEOFException(constructErrorMessage("Premature EOF"));
-            }
-            return (byte)ret;
-        } catch (IOException e) {
-            throw new RuntimeIOException(constructErrorMessage("Read error"), e);
-        }
-    }
-
-    /**
-     * @return true if it is possible to know for sure if at EOF, and it is known for sure.
-     * If the input stream is a ByteArrayInputStream, this is faster than causing a RuntimeEOFException
-     * to be thrown.
-     */
-    public boolean knownAtEof() {
-        if (isWriting) {
-            throw new IllegalStateException("Calling knownAtEof method on BinaryCodec open for write.");
-        }
-        try {
-            return inputStream instanceof ByteArrayInputStream && inputStream.available() == 0;
-        } catch (IOException e) {
-            throw new RuntimeIOException(constructErrorMessage("available() error"), e);
-        }
-    }
-
-    /**
-     * Read a string off the input stream, as ASCII bytes
-     *
-     * @param length length of string to read
-     * @return String read from stream
-     */
-    public String readString(final int length) {
-        final byte[] buffer;
-        // Recycle single buffer if possible
-        if (length <= scratchBuffer.length) {
-            buffer = scratchBuffer;
-        } else {
-            buffer = new byte[length];
-
-        }
-        readBytes(buffer, 0, length);
-
-        return StringUtil.bytesToString(buffer, 0, length);
-    }
-
-    /**
-     * Read ASCII bytes from the input stream until a null byte is read
-     * @return String constructed from the ASCII bytes read
-     */
-    public String readNullTerminatedString() {
-        return StringUtil.readNullTerminatedString(this);
-    }
-
-    /**
-     * Read an int length, and then a String of that length
-     * @param devourNull if true, the length include a null terminator, which is read and discarded
-     */
-    public String readLengthAndString(final boolean devourNull) {
-        int length = readInt();
-        if (devourNull) {
-            --length;
-        }
-        final String ret = readString(length);
-        if (devourNull) {
-            readByte();
-        }
-        return ret;
-    }
-
-    private void readByteBuffer(final int numBytes) {
-        assert(numBytes <= byteBuffer.capacity());
-        readBytes(byteBuffer.array(), 0, numBytes);
-        byteBuffer.limit(byteBuffer.capacity());
-        byteBuffer.position(numBytes);
-    }
-
-    /**
-     * Read an int off the input stream
-     *
-     * @return int from input stream
-     */
-    public int readInt() {
-        readByteBuffer(4);
-        byteBuffer.flip();
-        return byteBuffer.getInt();
-    }
-
-    /**
-     * Reads a double off the input stream
-     *
-     * @return double
-     */
-    public double readDouble() {
-        readByteBuffer(8);
-        byteBuffer.flip();
-        return byteBuffer.getDouble();
-    }
-
-    /**
-     * Reads a long off the input stream
-     *
-     * @return long
-     */
-    public long readLong()  {
-        readByteBuffer(8);
-        byteBuffer.flip();
-        return byteBuffer.getLong();
-    }
-
-    public short readShort() {
-        readByteBuffer(2);
-        byteBuffer.flip();
-        return byteBuffer.getShort();
-    }
-
-    /**
-     * Reads a float off the input stream
-     *
-     * @return float
-     */
-    public float readFloat() {
-        readByteBuffer(4);
-        byteBuffer.flip();
-        return byteBuffer.getFloat();
-    }
-
-    /**
-     * Reads a boolean off the input stream, represented as a byte with value 1 or 0
-     *
-     * @return boolean
-     */
-    public boolean readBoolean() {
-        return (((int)readByte()) == 1);
-    }
-
-    /**
-     * Reads an 8-bit unsigned byte from the input stream.
-     * This method assumes little-endianness.
-     */
-    public short readUByte() {
-        readByteBuffer(1);
-        byteBuffer.put((byte)0);
-        byteBuffer.flip();
-        return byteBuffer.getShort();
-    }
-
-    /**
-     * Reads a 16-bit unsigned short from the input stream.
-     * This method assumes little-endianness.
-     */
-    public int readUShort() {
-        readByteBuffer(2);
-        byteBuffer.putShort((short)0);
-        byteBuffer.flip();
-        return byteBuffer.getInt();
-    }
-
-    /**
-     * Reads a 32-bit unsigned int from the input stream.
-     * This method assumes little-endianness.
-     */
-    public long readUInt() {
-        readByteBuffer(4);
-        byteBuffer.putInt(0);
-        byteBuffer.flip();
-        return byteBuffer.getLong();
-    }
-
-    /**
-     * Close the appropriate stream
-     */
-    public void close() {
-        try {
-            if (this.isWriting) {
-                // To the degree possible, make sure the bytes get forced to the file system,
-                // or else cause an exception to be thrown.
-                if (this.outputStream instanceof FileOutputStream) {
-                    this.outputStream.flush();
-                    FileOutputStream fos = (FileOutputStream)this.outputStream;
-                    try {
-                        fos.getFD().sync();
-                    } catch (SyncFailedException e) {
-                        // Since the sync is belt-and-suspenders anyway, don't throw an exception if it fails,
-                        // because on some OSs it will fail for some types of output.  E.g. writing to /dev/null
-                        // on some Unixes.
-                    }
-                }
-                this.outputStream.close();
-            }
-            else this.inputStream.close();
-        } catch (IOException e) {
-            throw new RuntimeIOException(e.getMessage(), e);
-        }
-    }
-
-    private String constructErrorMessage(final String msg) {
-        final StringBuilder sb = new StringBuilder(msg);
-        sb.append("; BinaryCodec in ");
-        sb.append(isWriting? "write": "read");
-        sb.append("mode; ");
-        final String filename = isWriting? outputFileName: inputFileName;
-        if (filename != null) {
-            sb.append("file: ");
-            sb.append(filename);
-        } else  {
-            sb.append("streamed file (filename not available)");
-        }
-        return sb.toString();
-    }
-
-    //////////////////////////////////////////////////
-    // Some getters                                 //
-    //////////////////////////////////////////////////
-
-
-    public String getInputFileName() {
-        return inputFileName;
-    }
-
-    public String getOutputFileName() {
-        return outputFileName;
-    }
-
-    public void setOutputFileName(final String outputFileName) {
-        this.outputFileName = outputFileName;
-    }
-
-    public void setInputFileName(final String inputFileName) {
-        this.inputFileName = inputFileName;
-    }
-
-    public boolean isWriting() {
-        return isWriting;
-    }
-
-    public OutputStream getOutputStream() {
-        return outputStream;
-    }
-
-    public InputStream getInputStream() {
-        return inputStream;
-    }
-
-    public void setInputStream(final InputStream is) {
-        isWriting = false;
-        this.inputStream = is;
-    }
-
-    public void setOutputStream(final OutputStream os) {
-        isWriting = true;
-        this.outputStream = os;
-
-    }
-}
diff --git a/net/sf/samtools/util/BlockCompressedFilePointerUtil.java b/net/sf/samtools/util/BlockCompressedFilePointerUtil.java
deleted file mode 100644
index f593e33..0000000
--- a/net/sf/samtools/util/BlockCompressedFilePointerUtil.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2010 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package net.sf.samtools.util;
-
-/**
- * Static for manipulating virtual file pointers in BGZF files.
- */
-public class BlockCompressedFilePointerUtil {
-    private static final int SHIFT_AMOUNT = 16;
-    private static final int OFFSET_MASK = 0xffff;
-    private static final long ADDRESS_MASK = 0xFFFFFFFFFFFFL;
-
-    public static final long MAX_BLOCK_ADDRESS = ADDRESS_MASK;
-    public static final int MAX_OFFSET = OFFSET_MASK;
-    
-    /**
-     * @param vfp1
-     * @param vfp2
-     * @return negative if vfp1 is earlier in file than vfp2, positive if it is later, 0 if equal.
-     */
-    public static int compare(final long vfp1, final long vfp2) {
-        if (vfp1 == vfp2) return 0;
-        // When treating as unsigned, negative number is > positive.
-        if (vfp1 < 0 && vfp2 >= 0) return 1;
-        if (vfp1 >= 0 && vfp2 < 0) return -1;
-        // Either both negative or both non-negative, so regular comparison works.
-        if (vfp1 < vfp2) return -1;
-        return 1; // vfp1 > vfp2
-    }
-
-    /**
-     * @return true if vfp2 points to somewhere in the same BGZF block, or the one immediately following vfp1's BGZF block.
-     */
-    public static boolean areInSameOrAdjacentBlocks(final long vfp1, final long vfp2) {
-        final long block1 = getBlockAddress(vfp1);
-        final long block2 = getBlockAddress(vfp2);
-        return (block1 == block2 || block1 + 1 == block2);        
-    }
-
-    /**
-     * @param blockAddress File offset of start of BGZF block.
-     * @param blockOffset Offset into uncompressed block.
-     * @return Virtual file pointer that embodies the input parameters.
-     */
-    static long makeFilePointer(final long blockAddress, final int blockOffset) {
-        if (blockOffset < 0) {
-            throw new IllegalArgumentException("Negative blockOffset " + blockOffset + " not allowed.");
-        }
-        if (blockAddress < 0) {
-            throw new IllegalArgumentException("Negative blockAddress " + blockAddress + " not allowed.");
-        }
-        if (blockOffset > MAX_OFFSET) {
-            throw new IllegalArgumentException("blockOffset " + blockOffset + " too large.");
-        }
-        if (blockAddress > MAX_BLOCK_ADDRESS) {
-            throw new IllegalArgumentException("blockAddress " + blockAddress + " too large.");
-        }
-        return blockAddress << SHIFT_AMOUNT | blockOffset;
-    }
-
-    /**
-     * @param virtualFilePointer
-     * @return File offset of start of BGZF block for this virtual file pointer.
-     */
-    public static long getBlockAddress(final long virtualFilePointer) {
-        return (virtualFilePointer >> SHIFT_AMOUNT) & ADDRESS_MASK;
-    }
-
-    /**
-     * @param virtualFilePointer
-     * @return Offset into uncompressed block for this virtual file pointer.
-     */
-    public static int getBlockOffset(final long virtualFilePointer) {
-        return (int) (virtualFilePointer & OFFSET_MASK);
-    }
-
-    public static String asString(final long vfp) {
-        return String.format("%d(0x%x): (block address: %d, offset: %d)", vfp, vfp, getBlockAddress(vfp), getBlockOffset(vfp));
-    }
-}
diff --git a/net/sf/samtools/util/BlockCompressedInputStream.java b/net/sf/samtools/util/BlockCompressedInputStream.java
deleted file mode 100644
index ed04c8e..0000000
--- a/net/sf/samtools/util/BlockCompressedInputStream.java
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2009 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package net.sf.samtools.util;
-
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.RandomAccessFile;
-import java.net.URL;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.Arrays;
-import net.sf.samtools.FileTruncatedException;
-
-/*
- * Utility class for reading BGZF block compressed files.  The caller can treat this file like any other InputStream.
- * It probably is not necessary to wrap this stream in a buffering stream, because there is internal buffering.
- * The advantage of BGZF over conventional GZip format is that BGZF allows for seeking without having to read the
- * entire file up to the location being sought.  Note that seeking is only possible if the ctor(File) is used.
- *
- * c.f. http://samtools.sourceforge.net/SAM1.pdf for details of BGZF format
- */
-public class BlockCompressedInputStream extends InputStream {
-    private InputStream mStream = null;
-    private SeekableStream mFile = null;
-    private byte[] mFileBuffer = null;
-    private byte[] mCurrentBlock = null;
-    private int mCurrentOffset = 0;
-    private long mBlockAddress = 0;
-    private int mLastBlockLength = 0;
-    private final BlockGunzipper blockGunzipper = new BlockGunzipper();
-
-
-    /**
-     * Note that seek() is not supported if this ctor is used.
-     */
-    public BlockCompressedInputStream(final InputStream stream) {
-        mStream = IOUtil.toBufferedStream(stream);
-        mFile = null;
-    }
-
-    /**
-     * Use this ctor if you wish to call seek()
-     */
-    public BlockCompressedInputStream(final File file)
-        throws IOException {
-        mFile = new SeekableFileStream(file);
-        mStream = null;
-
-    }
-
-    public BlockCompressedInputStream(final URL url) {
-        mFile = new SeekableBufferedStream(new SeekableHTTPStream(url));
-        mStream = null;
-    }
-
-    /**
-     * For providing some arbitrary data source.  No additional buffering is
-     * provided, so if the underlying source is not buffered, wrap it in a
-     * SeekableBufferedStream before passing to this ctor.
-     */
-    public BlockCompressedInputStream(final SeekableStream strm) {
-        mFile = strm;
-        mStream = null;
-    }
-
-    /**
-     * Determines whether or not the inflater will re-calculated the CRC on the decompressed data
-     * and check it against the value stored in the GZIP header.  CRC checking is an expensive
-     * operation and should be used accordingly.
-     */
-    public void setCheckCrcs(final boolean check) {
-        this.blockGunzipper.setCheckCrcs(check);
-    }
-
-    /**
-     * @return the number of bytes that can be read (or skipped over) from this input stream without blocking by the
-     * next caller of a method for this input stream. The next caller might be the same thread or another thread.
-     * Note that although the next caller can read this many bytes without blocking, the available() method call itself
-     * may block in order to fill an internal buffer if it has been exhausted.
-     */
-    @Override
-    public int available()
-        throws IOException {
-        if (mCurrentBlock == null || mCurrentOffset == mCurrentBlock.length) {
-            readBlock();
-        }
-        if (mCurrentBlock == null) {
-            return 0;
-        }
-        return mCurrentBlock.length - mCurrentOffset;
-    }
-
-    /**
-     * Closes the underlying InputStream or RandomAccessFile
-     */
-    @Override
-    public void close()
-        throws IOException {
-        if (mFile != null) {
-            mFile.close();
-            mFile = null;
-        } else if (mStream != null) {
-            mStream.close();
-            mStream = null;
-        }
-        // Encourage garbage collection
-        mFileBuffer = null;
-        mCurrentBlock = null;
-    }
-
-    /**
-     * Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255.
-     * If no byte is available because the end of the stream has been reached, the value -1 is returned.
-     * This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.
-
-     * @return the next byte of data, or -1 if the end of the stream is reached.
-     */
-    @Override
-    public int read()
-        throws IOException {
-        return (available() > 0) ? (mCurrentBlock[mCurrentOffset++] & 0xFF) : -1;
-    }
-
-    /**
-     * Reads some number of bytes from the input stream and stores them into the buffer array b. The number of bytes
-     * actually read is returned as an integer. This method blocks until input data is available, end of file is detected,
-     * or an exception is thrown.
-     *
-     * read(buf) has the same effect as read(buf, 0, buf.length).
-     *
-     * @param buffer the buffer into which the data is read.
-     * @return the total number of bytes read into the buffer, or -1 is there is no more data because the end of
-     * the stream has been reached.
-     */
-    @Override
-    public int read(final byte[] buffer)
-        throws IOException {
-        return read(buffer, 0, buffer.length);
-    }
-
-    private volatile ByteArrayOutputStream buf = null;
-    private static final byte eol = '\n';
-    private static final byte eolCr = '\r';
-
-    /**
-     * Reads a whole line. A line is considered to be terminated by either a line feed ('\n'),
-     * carriage return ('\r') or carriage return followed by a line feed ("\r\n").
-     *
-     * @return  A String containing the contents of the line, excluding the line terminating
-     *          character, or null if the end of the stream has been reached
-     *
-     * @exception  IOException  If an I/O error occurs
-     * 
-     */
-    public String readLine() throws IOException {
-    	int available = available();
-        if (available == 0) {
-            return null;
-        }
-        if(null == buf){ // lazy initialisation
-        	buf = new ByteArrayOutputStream(8192);
-        }
-        buf.reset();
-    	boolean done = false;
-    	boolean foundCr = false; // \r found flag
-        while (!done) {
-        	int linetmpPos = mCurrentOffset;
-        	int bCnt = 0;
-        	while((available-- > 0)){
-        		final byte c = mCurrentBlock[linetmpPos++];
-        		if(c == eol){ // found \n
-        			done = true;
-        			break;
-        		} else if(foundCr){  // previous char was \r
-        			--linetmpPos; // current char is not \n so put it back
-        			done = true;
-        			break;
-        		} else if(c == eolCr){ // found \r
-					foundCr = true;
-        			continue; // no ++bCnt
-        		}
-				++bCnt;
-        	}
-        	if(mCurrentOffset < linetmpPos){
-				buf.write(mCurrentBlock, mCurrentOffset, bCnt);
-	        	mCurrentOffset = linetmpPos;
-        	}
-        	available = available();
-        	if(available == 0){
-        		// EOF
-        		done = true;
-        	}
-        }
-    	return buf.toString();
-    }
-
-    /**
-     * Reads up to len bytes of data from the input stream into an array of bytes. An attempt is made to read
-     * as many as len bytes, but a smaller number may be read. The number of bytes actually read is returned as an integer.
-     *
-     * This method blocks until input data is available, end of file is detected, or an exception is thrown.
-     *
-     * @param buffer buffer into which data is read.
-     * @param offset the start offset in array b  at which the data is written.
-     * @param length the maximum number of bytes to read.
-     * @return the total number of bytes read into the buffer, or -1 if there is no more data because the end of
-     * the stream has been reached.
-     */
-    @Override
-    public int read(final byte[] buffer, int offset, int length)
-        throws IOException {
-        final int originalLength = length;
-        while (length > 0) {
-            final int available = available();
-            if (available == 0) {
-                // Signal EOF to caller
-                if (originalLength == length) {
-                    return -1;
-                }
-                break;
-            }
-            final int copyLength = Math.min(length, available);
-            System.arraycopy(mCurrentBlock, mCurrentOffset, buffer, offset, copyLength);
-            mCurrentOffset += copyLength;
-            offset += copyLength;
-            length -= copyLength;
-        }
-        return originalLength - length;
-    }
-
-    /**
-     * Seek to the given position in the file.  Note that pos is a special virtual file pointer,
-     * not an actual byte offset.
-     *
-     * @param pos virtual file pointer
-     */
-    public void seek(final long pos)
-        throws IOException {
-        if (mFile == null) {
-            throw new IOException("Cannot seek on stream based file");
-        }
-        // Decode virtual file pointer
-        // Upper 48 bits is the byte offset into the compressed stream of a block.
-        // Lower 16 bits is the byte offset into the uncompressed stream inside the block.
-        final long compressedOffset = BlockCompressedFilePointerUtil.getBlockAddress(pos);
-        final int uncompressedOffset = BlockCompressedFilePointerUtil.getBlockOffset(pos);
-        final int available;
-        if (mBlockAddress == compressedOffset && mCurrentBlock != null) {
-            available = mCurrentBlock.length;
-        } else {
-            mFile.seek(compressedOffset);
-            mBlockAddress = compressedOffset;
-            mLastBlockLength = 0;
-            readBlock();
-            available = available();
-        }
-        if (uncompressedOffset > available ||
-                (uncompressedOffset == available && !eof())) {
-            throw new IOException("Invalid file pointer: " + pos);
-        }
-        mCurrentOffset = uncompressedOffset;
-    }
-
-    private boolean eof() throws IOException {
-        if (mFile.eof()) {
-            return true;
-        }
-        // If the last remaining block is the size of the EMPTY_GZIP_BLOCK, this is the same as being at EOF.
-        return (mFile.length() - (mBlockAddress + mLastBlockLength) == BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK.length);
-    }
-
-    /**
-     * @return virtual file pointer that can be passed to seek() to return to the current position.  This is
-     * not an actual byte offset, so arithmetic on file pointers cannot be done to determine the distance between
-     * the two.
-     */
-    public long getFilePointer() {
-        if (mCurrentOffset == mCurrentBlock.length) {
-            // If current offset is at the end of the current block, file pointer should point
-            // to the beginning of the next block.
-            return BlockCompressedFilePointerUtil.makeFilePointer(mBlockAddress + mLastBlockLength, 0);
-        }
-        return BlockCompressedFilePointerUtil.makeFilePointer(mBlockAddress, mCurrentOffset);
-    }
-
-    public static long getFileBlock(final long bgzfOffset) {
-        return BlockCompressedFilePointerUtil.getBlockAddress(bgzfOffset);
-    }
-
-    /**
-     * @param stream Must be at start of file.  Throws RuntimeException if !stream.markSupported().
-     * @return true if the given file looks like a valid BGZF file.
-     */
-    public static boolean isValidFile(final InputStream stream)
-        throws IOException {
-        if (!stream.markSupported()) {
-            throw new RuntimeException("Cannot test non-buffered stream");
-        }
-        stream.mark(BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH);
-        final byte[] buffer = new byte[BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH];
-        final int count = readBytes(stream, buffer, 0, BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH);
-        stream.reset();
-        return count == BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH && isValidBlockHeader(buffer);
-    }
-
-    private static boolean isValidBlockHeader(final byte[] buffer) {
-        return (buffer[0] == BlockCompressedStreamConstants.GZIP_ID1 &&
-                (buffer[1] & 0xFF) == BlockCompressedStreamConstants.GZIP_ID2 &&
-                (buffer[3] & BlockCompressedStreamConstants.GZIP_FLG) != 0 &&
-                buffer[10] == BlockCompressedStreamConstants.GZIP_XLEN &&
-                buffer[12] == BlockCompressedStreamConstants.BGZF_ID1 &&
-                buffer[13] == BlockCompressedStreamConstants.BGZF_ID2);
-    }
-
-    private void readBlock()
-        throws IOException {
-
-        if (mFileBuffer == null) {
-            mFileBuffer = new byte[BlockCompressedStreamConstants.MAX_COMPRESSED_BLOCK_SIZE];
-        }
-        int count = readBytes(mFileBuffer, 0, BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH);
-        if (count == 0) {
-            // Handle case where there is no empty gzip block at end.
-            mCurrentOffset = 0;
-            mBlockAddress += mLastBlockLength;
-            mCurrentBlock = new byte[0];
-            return;
-        }
-        if (count != BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH) {
-            throw new IOException("Premature end of file");
-        }
-        final int blockLength = unpackInt16(mFileBuffer, BlockCompressedStreamConstants.BLOCK_LENGTH_OFFSET) + 1;
-        if (blockLength < BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH || blockLength > mFileBuffer.length) {
-            throw new IOException("Unexpected compressed block length: " + blockLength);
-        }
-        final int remaining = blockLength - BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH;
-        count = readBytes(mFileBuffer, BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH, remaining);
-        if (count != remaining) {
-            throw new FileTruncatedException("Premature end of file");
-        }
-        inflateBlock(mFileBuffer, blockLength);
-        mCurrentOffset = 0;
-        mBlockAddress += mLastBlockLength;
-        mLastBlockLength = blockLength;
-    }
-
-    private void inflateBlock(final byte[] compressedBlock, final int compressedLength)
-        throws IOException {
-        final int uncompressedLength = unpackInt32(compressedBlock, compressedLength-4);
-        byte[] buffer = mCurrentBlock;
-        mCurrentBlock = null;
-        if (buffer == null || buffer.length != uncompressedLength) {
-            try {
-                buffer = new byte[uncompressedLength];
-            } catch (NegativeArraySizeException e) {
-                throw new RuntimeException("BGZF file has invalid uncompressedLength: " + uncompressedLength, e);
-            }
-        }
-        blockGunzipper.unzipBlock(buffer, compressedBlock, compressedLength);
-        mCurrentBlock = buffer;
-    }
-
-    private int readBytes(final byte[] buffer, final int offset, final int length)
-        throws IOException {
-        if (mFile != null) {
-            return readBytes(mFile, buffer, offset, length);
-        } else if (mStream != null) {
-            return readBytes(mStream, buffer, offset, length);
-        } else {
-            return 0;
-        }
-    }
-
-    private static int readBytes(final SeekableStream file, final byte[] buffer, final int offset, final int length)
-        throws IOException {
-        int bytesRead = 0;
-        while (bytesRead < length) {
-            final int count = file.read(buffer, offset + bytesRead, length - bytesRead);
-            if (count <= 0) {
-                break;
-            }
-            bytesRead += count;
-        }
-        return bytesRead;
-    }
-
-    private static int readBytes(final InputStream stream, final byte[] buffer, final int offset, final int length)
-        throws IOException {
-        int bytesRead = 0;
-        while (bytesRead < length) {
-            final int count = stream.read(buffer, offset + bytesRead, length - bytesRead);
-            if (count <= 0) {
-                break;
-            }
-            bytesRead += count;
-        }
-        return bytesRead;
-    }
-
-    private int unpackInt16(final byte[] buffer, final int offset) {
-        return ((buffer[offset] & 0xFF) |
-                ((buffer[offset+1] & 0xFF) << 8));
-    }
-
-    private int unpackInt32(final byte[] buffer, final int offset) {
-        return ((buffer[offset] & 0xFF) |
-                ((buffer[offset+1] & 0xFF) << 8) |
-                ((buffer[offset+2] & 0xFF) << 16) |
-                ((buffer[offset+3] & 0xFF) << 24));
-    }
-
-    public enum FileTermination {HAS_TERMINATOR_BLOCK, HAS_HEALTHY_LAST_BLOCK, DEFECTIVE}
-
-    public static FileTermination checkTermination(final File file)
-        throws IOException {
-        final long fileSize = file.length();
-        if (fileSize < BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK.length) {
-            return FileTermination.DEFECTIVE;
-        }
-        try (RandomAccessFile raFile=new RandomAccessFile(file, "r")) {
-            raFile.seek(fileSize - BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK.length);
-            byte[] buf = new byte[BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK.length];
-            raFile.readFully(buf);
-            if (Arrays.equals(buf, BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK)) {
-                return FileTermination.HAS_TERMINATOR_BLOCK;
-            }
-            final int bufsize = (int)Math.min(fileSize, BlockCompressedStreamConstants.MAX_COMPRESSED_BLOCK_SIZE);
-            buf = new byte[bufsize];
-            raFile.seek(fileSize - bufsize);
-            raFile.read(buf);
-            for (int i = buf.length - BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK.length;
-                    i >= 0; --i) {
-                if (!preambleEqual(BlockCompressedStreamConstants.GZIP_BLOCK_PREAMBLE,
-                        buf, i, BlockCompressedStreamConstants.GZIP_BLOCK_PREAMBLE.length)) {
-                    continue;
-                }
-                final ByteBuffer byteBuffer = ByteBuffer.wrap(buf, i + BlockCompressedStreamConstants.GZIP_BLOCK_PREAMBLE.length, 4);
-                byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
-                final int totalBlockSizeMinusOne =  byteBuffer.getShort() & 0xFFFF;
-                if (buf.length - i == totalBlockSizeMinusOne + 1) {
-                    return FileTermination.HAS_HEALTHY_LAST_BLOCK;
-                } else {
-                    return FileTermination.DEFECTIVE;
-                }
-            }
-            return FileTermination.DEFECTIVE;
-        }
-    }
-
-    private static boolean preambleEqual(final byte[] preamble, final byte[] buf, final int startOffset, final int length) {
-        for (int i = 0; i < length; ++i) {
-            if (preamble[i] != buf[i + startOffset]) {
-                return false;
-            }
-        }
-        return true;
-    }
-}
-
-
diff --git a/net/sf/samtools/util/BlockCompressedOutputStream.java b/net/sf/samtools/util/BlockCompressedOutputStream.java
deleted file mode 100644
index 61f3d47..0000000
--- a/net/sf/samtools/util/BlockCompressedOutputStream.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2009 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package net.sf.samtools.util;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.zip.CRC32;
-import java.util.zip.Deflater;
-
-/**
- * Writer for a file that is a series of gzip blocks (BGZF format).  The caller just treats it as an
- * OutputStream, and under the covers a gzip block is written when the amount of uncompressed as-yet-unwritten
- * bytes reaches a threshold.
- *
- * The advantage of BGZF over conventional gzip is that BGZF allows for seeking without having to scan through
- * the entire file up to the position being sought.
- *
- * Note that the flush() method should not be called by client
- * unless you know what you're doing, because it forces a gzip block to be written even if the
- * number of buffered bytes has not reached threshold.  close(), on the other hand, must be called
- * when done writing in order to force the last gzip block to be written.
- *
- * c.f. http://samtools.sourceforge.net/SAM1.pdf for details of BGZF file format.
- */
-public class BlockCompressedOutputStream
-        extends OutputStream
-{
-    private static int defaultCompressionLevel = BlockCompressedStreamConstants.DEFAULT_COMPRESSION_LEVEL;
-
-    /**
-     * Sets the GZip compression level for subsequent BlockCompressedOutputStream object creation
-     * that do not specify the compression level.
-     * @param compressionLevel {@code 1 <= compressionLevel <= 9}
-     */
-    public static void setDefaultCompressionLevel(final int compressionLevel) {
-        if (compressionLevel < Deflater.NO_COMPRESSION || compressionLevel > Deflater.BEST_COMPRESSION) {
-            throw new IllegalArgumentException("Invalid compression level: " + compressionLevel);
-        }
-        defaultCompressionLevel = compressionLevel;
-    }
-
-    public static int getDefaultCompressionLevel() {
-        return defaultCompressionLevel;
-    }
-
-    private final BinaryCodec codec;
-    private final byte[] uncompressedBuffer = new byte[BlockCompressedStreamConstants.DEFAULT_UNCOMPRESSED_BLOCK_SIZE];
-    private int numUncompressedBytes = 0;
-    private final byte[] compressedBuffer =
-            new byte[BlockCompressedStreamConstants.MAX_COMPRESSED_BLOCK_SIZE -
-                    BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH];
-    private final Deflater deflater;
-
-    // A second deflater is created for the very unlikely case where the regular deflation actually makes
-    // things bigger, and the compressed block is too big.  It should be possible to downshift the
-    // primary deflater to NO_COMPRESSION level, recompress, and then restore it to its original setting,
-    // but in practice that doesn't work.
-    // The motivation for deflating at NO_COMPRESSION level is that it will predictably produce compressed
-    // output that is 10 bytes larger than the input, and the threshold at which a block is generated is such that
-    // the size of tbe final gzip block will always be <= 64K.  This is preferred over the previous method,
-    // which would attempt to compress up to 64K bytes, and if the resulting compressed block was too large,
-    // try compressing fewer input bytes (aka "downshifting').  The problem with downshifting is that
-    // getFilePointer might return an inaccurate value.
-    private final Deflater noCompressionDeflater = new Deflater(Deflater.NO_COMPRESSION, true);
-    private final CRC32 crc32 = new CRC32();
-    private File file = null;
-    private long mBlockAddress = 0;
-
-
-    // Really a local variable, but allocate once to reduce GC burden.
-    private final byte[] singleByteArray = new byte[1];
-
-    /**
-     * Uses default compression level, which is 5 unless changed by setDefaultCompressionLevel
-     */
-    public BlockCompressedOutputStream(final String filename) {
-        this(filename, defaultCompressionLevel);
-    }
-
-    /**
-     * Uses default compression level, which is 5 unless changed by setDefaultCompressionLevel
-     */
-    public BlockCompressedOutputStream(final File file) {
-        this(file, defaultCompressionLevel);
-    }
-
-    /**
-     * Prepare to compress at the given compression level
-     * @param compressionLevel {@code 1 <= compressionLevel <= 9}
-     */
-    public BlockCompressedOutputStream(final String filename, final int compressionLevel) {
-        this(new File(filename), compressionLevel);
-    }
-
-    /**
-     * Prepare to compress at the given compression level
-     * @param compressionLevel {@code 1 <= compressionLevel <= 9}
-     */
-    public BlockCompressedOutputStream(final File file, final int compressionLevel) {
-        this.file = file;
-        codec = new BinaryCodec(file, true);
-        deflater = new Deflater(compressionLevel, true);
-    }
-
-    /**
-     * Constructors that take output streams
-     * file may be null
-     */
-    public BlockCompressedOutputStream(final OutputStream os, File file) {
-        this(os, file, defaultCompressionLevel);
-    }
-
-    public BlockCompressedOutputStream(final OutputStream os, final File file, final int compressionLevel) {
-        this.file = file;
-        codec = new BinaryCodec(os);
-        if (file != null) {
-            codec.setOutputFileName(file.getAbsolutePath());
-        }
-        deflater = new Deflater(compressionLevel, true);
-    }
-
-    /**
-     * Writes b.length bytes from the specified byte array to this output stream. The general contract for write(b)
-     * is that it should have exactly the same effect as the call write(b, 0, b.length).
-     * @param bytes the data
-     */
-    @Override
-    public void write(final byte[] bytes) throws IOException {
-        write(bytes, 0, bytes.length);
-    }
-
-    /**
-     * Writes len bytes from the specified byte array starting at offset off to this output stream. The general
-     * contract for write(b, off, len) is that some of the bytes in the array b are written to the output stream in order;
-     * element b[off] is the first byte written and b[off+len-1] is the last byte written by this operation.
-     *
-     * @param bytes the data
-     * @param startIndex the start offset in the data
-     * @param numBytes the number of bytes to write
-     */
-    @Override
-    public void write(final byte[] bytes, int startIndex, int numBytes) throws IOException {
-        assert(numUncompressedBytes < uncompressedBuffer.length);
-        while (numBytes > 0) {
-            final int bytesToWrite = Math.min(uncompressedBuffer.length - numUncompressedBytes, numBytes);
-            System.arraycopy(bytes, startIndex, uncompressedBuffer, numUncompressedBytes, bytesToWrite);
-            numUncompressedBytes += bytesToWrite;
-            startIndex += bytesToWrite;
-            numBytes -= bytesToWrite;
-            assert(numBytes >= 0);
-            if (numUncompressedBytes == uncompressedBuffer.length) {
-                deflateBlock();
-            }
-        }
-    }
-
-    /**
-     * WARNING: flush() affects the output format, because it causes the current contents of uncompressedBuffer
-     * to be compressed and written, even if it isn't full.  Unless you know what you're doing, don't call flush().
-     * Instead, call close(), which will flush any unwritten data before closing the underlying stream.
-     *
-     */
-    @Override
-    public void flush() throws IOException {
-        while (numUncompressedBytes > 0) {
-            deflateBlock();
-        }
-        codec.getOutputStream().flush();
-    }
-
-    /**
-     * close() must be called in order to flush any remaining buffered bytes.  An unclosed file will likely be
-     * defective.
-     *
-     */
-    @Override
-    public void close() throws IOException {
-        flush();
-        // For debugging...
-        // if (numberOfThrottleBacks > 0) {
-        //     System.err.println("In BlockCompressedOutputStream, had to throttle back " + numberOfThrottleBacks +
-        //                        " times for file " + codec.getOutputFileName());
-        // }
-        codec.writeBytes(BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK);
-        codec.close();
-        // Can't re-open something that is not a regular file, e.g. a named pipe or an output stream
-        if (this.file == null || !this.file.isFile()) return;
-        if (BlockCompressedInputStream.checkTermination(this.file) !=
-                BlockCompressedInputStream.FileTermination.HAS_TERMINATOR_BLOCK) {
-            throw new IOException("Terminator block not found after closing BGZF file " + this.file);
-        }
-    }
-
-    /**
-     * Writes the specified byte to this output stream. The general contract for write is that one byte is written
-     * to the output stream. The byte to be written is the eight low-order bits of the argument b.
-     * The 24 high-order bits of b are ignored.
-     * @param bite
-     * @throws IOException
-     */
-    @Override
-    public void write(final int bite) throws IOException {
-        singleByteArray[0] = (byte)bite;
-        write(singleByteArray);
-    }
-
-    /** Encode virtual file pointer
-     * Upper 48 bits is the byte offset into the compressed stream of a block.
-     * Lower 16 bits is the byte offset into the uncompressed stream inside the block.
-     */
-    public long getFilePointer(){
-        return BlockCompressedFilePointerUtil.makeFilePointer(mBlockAddress, numUncompressedBytes);
-    }
-
-    /**
-     * Attempt to write the data in uncompressedBuffer to the underlying file in a gzip block.
-     * If the entire uncompressedBuffer does not fit in the maximum allowed size, reduce the amount
-     * of data to be compressed, and slide the excess down in uncompressedBuffer so it can be picked
-     * up in the next deflate event.
-     * @return size of gzip block that was written.
-     */
-    private int deflateBlock() {
-        if (numUncompressedBytes == 0) {
-            return 0;
-        }
-        int bytesToCompress = numUncompressedBytes;
-        // Compress the input
-        deflater.reset();
-        deflater.setInput(uncompressedBuffer, 0, bytesToCompress);
-        deflater.finish();
-        int compressedSize = deflater.deflate(compressedBuffer, 0, compressedBuffer.length);
-
-        // If it didn't all fit in compressedBuffer.length, set compression level to NO_COMPRESSION
-        // and try again.  This should always fit.
-        if (!deflater.finished()) {
-            noCompressionDeflater.reset();
-            noCompressionDeflater.setInput(uncompressedBuffer, 0, bytesToCompress);
-            noCompressionDeflater.finish();
-            compressedSize = noCompressionDeflater.deflate(compressedBuffer, 0, compressedBuffer.length);
-            if (!noCompressionDeflater.finished()) {
-                throw new IllegalStateException("unpossible");
-            }
-        }
-        // Data compressed small enough, so write it out.
-        crc32.reset();
-        crc32.update(uncompressedBuffer, 0, bytesToCompress);
-
-        final int totalBlockSize = writeGzipBlock(compressedSize, bytesToCompress, crc32.getValue());
-        assert(bytesToCompress <= numUncompressedBytes);
-
-        // Clear out from uncompressedBuffer the data that was written
-        if (bytesToCompress == numUncompressedBytes) {
-            numUncompressedBytes = 0;
-        } else {
-            System.arraycopy(uncompressedBuffer, bytesToCompress, uncompressedBuffer, 0,
-                    numUncompressedBytes - bytesToCompress);
-            numUncompressedBytes -= bytesToCompress;
-        }
-        mBlockAddress += totalBlockSize;
-        return totalBlockSize;
-    }
-
-    /**
-     * Writes the entire gzip block, assuming the compressed data is stored in compressedBuffer
-     * @return  size of gzip block that was written.
-     */
-    private int writeGzipBlock(final int compressedSize, final int uncompressedSize, final long crc) {
-        // Init gzip header
-        codec.writeByte(BlockCompressedStreamConstants.GZIP_ID1);
-        codec.writeByte(BlockCompressedStreamConstants.GZIP_ID2);
-        codec.writeByte(BlockCompressedStreamConstants.GZIP_CM_DEFLATE);
-        codec.writeByte(BlockCompressedStreamConstants.GZIP_FLG);
-        codec.writeInt(0); // Modification time
-        codec.writeByte(BlockCompressedStreamConstants.GZIP_XFL);
-        codec.writeByte(BlockCompressedStreamConstants.GZIP_OS_UNKNOWN);
-        codec.writeShort(BlockCompressedStreamConstants.GZIP_XLEN);
-        codec.writeByte(BlockCompressedStreamConstants.BGZF_ID1);
-        codec.writeByte(BlockCompressedStreamConstants.BGZF_ID2);
-        codec.writeShort(BlockCompressedStreamConstants.BGZF_LEN);
-        final int totalBlockSize = compressedSize + BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH +
-                BlockCompressedStreamConstants.BLOCK_FOOTER_LENGTH;
-
-        // I don't know why we store block size - 1, but that is what the spec says
-        codec.writeShort((short)(totalBlockSize - 1));
-        codec.writeBytes(compressedBuffer, 0, compressedSize);
-        codec.writeInt((int)crc);
-        codec.writeInt(uncompressedSize);
-        return totalBlockSize;
-    }
-}
diff --git a/net/sf/samtools/util/BlockCompressedStreamConstants.java b/net/sf/samtools/util/BlockCompressedStreamConstants.java
deleted file mode 100644
index ea25733..0000000
--- a/net/sf/samtools/util/BlockCompressedStreamConstants.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2009 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package net.sf.samtools.util;
-
-import net.sf.samtools.Defaults;
-
-/**
- * Constants shared by BlockCompressed{Input,Output}Stream classes
- */
-public class BlockCompressedStreamConstants {
-    // Number of bytes in the gzip block before the deflated data.
-    // This is not the standard header size, because we include one optional subfield,
-    // but it is the standard for us.
-    public static final int BLOCK_HEADER_LENGTH = 18;
-
-    // Location in the gzip block of the total block size (actually total block size - 1)
-    public static final int BLOCK_LENGTH_OFFSET = 16;
-
-    // Number of bytes that follow the deflated data
-    public static final int BLOCK_FOOTER_LENGTH = 8;
-
-    // We require that a compressed block (including header and footer, be <= this)
-    public static final int MAX_COMPRESSED_BLOCK_SIZE = 64 * 1024;
-
-    // Gzip overhead is the header, the footer, and the block size (encoded as a short).
-    public static final int GZIP_OVERHEAD = BLOCK_HEADER_LENGTH + BLOCK_FOOTER_LENGTH + 2;
-
-    // If Deflater has compression level == NO_COMPRESSION, 10 bytes of overhead (determined experimentally).
-    public static final int NO_COMPRESSION_OVERHEAD = 10;
-
-    // Push out a gzip block when this many uncompressed bytes have been accumulated.
-    // This size is selected so that if data is not compressible,  if Deflater is given
-    // compression level == NO_COMPRESSION, compressed size is guaranteed to be <= MAX_COMPRESSED_BLOCK_SIZE.
-    public static final int DEFAULT_UNCOMPRESSED_BLOCK_SIZE = 64 * 1024 - (GZIP_OVERHEAD + NO_COMPRESSION_OVERHEAD);
-
-    // Magic numbers
-    public static final byte GZIP_ID1 = 31;
-    public static final int GZIP_ID2 = 139;
-
-    // FEXTRA flag means there are optional fields
-    public static final int GZIP_FLG = 4;
-
-    // extra flags
-    public static final int GZIP_XFL = 0;
-
-    // length of extra subfield
-    public static final short GZIP_XLEN = 6;
-
-    // The deflate compression, which is customarily used by gzip
-    public static final byte GZIP_CM_DEFLATE = 8;
-
-    public static final int DEFAULT_COMPRESSION_LEVEL = Defaults.COMPRESSION_LEVEL;
-
-    // We don't care about OS because we're not doing line terminator translation
-    public static final int GZIP_OS_UNKNOWN = 255;
-
-    // The subfield ID
-    public static final byte BGZF_ID1 = 66;
-    public static final byte BGZF_ID2 = 67;
-
-    // subfield length in bytes
-    public static final byte BGZF_LEN = 2;
-
-    public static final byte[] EMPTY_GZIP_BLOCK = {
-            BlockCompressedStreamConstants.GZIP_ID1,
-            (byte)BlockCompressedStreamConstants.GZIP_ID2,
-            BlockCompressedStreamConstants.GZIP_CM_DEFLATE,
-            BlockCompressedStreamConstants.GZIP_FLG,
-            0, 0, 0, 0, // Modification time
-            BlockCompressedStreamConstants.GZIP_XFL,
-            (byte)BlockCompressedStreamConstants.GZIP_OS_UNKNOWN,
-            BlockCompressedStreamConstants.GZIP_XLEN, 0, // Little-endian short
-            BlockCompressedStreamConstants.BGZF_ID1,
-            BlockCompressedStreamConstants.BGZF_ID2,
-            BlockCompressedStreamConstants.BGZF_LEN, 0, // Little-endian short
-            // Total block size - 1
-            BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH +
-                    BlockCompressedStreamConstants.BLOCK_FOOTER_LENGTH - 1 + 2, 0, // Little-endian short
-            // Dummy payload?
-            3, 0,
-            0, 0, 0, 0, // crc
-            0, 0, 0, 0, // uncompressedSize
-    };
-    public static final byte[] GZIP_BLOCK_PREAMBLE = {
-            BlockCompressedStreamConstants.GZIP_ID1,
-            (byte)BlockCompressedStreamConstants.GZIP_ID2,
-            BlockCompressedStreamConstants.GZIP_CM_DEFLATE,
-            BlockCompressedStreamConstants.GZIP_FLG,
-            0, 0, 0, 0, // Modification time
-            BlockCompressedStreamConstants.GZIP_XFL,
-            (byte)BlockCompressedStreamConstants.GZIP_OS_UNKNOWN,
-            BlockCompressedStreamConstants.GZIP_XLEN, 0, // Little-endian short
-            BlockCompressedStreamConstants.BGZF_ID1,
-            BlockCompressedStreamConstants.BGZF_ID2,
-            BlockCompressedStreamConstants.BGZF_LEN, 0, // Little-endian short
-    };
-}
diff --git a/net/sf/samtools/util/BlockGunzipper.java b/net/sf/samtools/util/BlockGunzipper.java
deleted file mode 100644
index 365a6bd..0000000
--- a/net/sf/samtools/util/BlockGunzipper.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2009 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package net.sf.samtools.util;
-
-import net.sf.samtools.SAMFormatException;
-
-import java.util.zip.Inflater;
-import java.util.zip.CRC32;
-import java.util.zip.DataFormatException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * Alternative to GZIPInputStream, for decompressing GZIP blocks that are already loaded into a byte[].
- * The main advantage is that this object can be used over and over again to decompress many blocks,
- * whereas a new GZIPInputStream and ByteArrayInputStream would otherwise need to be created for each
- * block to be decompressed.
- *
- * This code requires that the GZIP header conform to the GZIP blocks written to BAM files, with
- * a specific subfield and no other optional stuff.
- *
- * @author alecw at broadinstitute.org
- */
-public class BlockGunzipper {
-    private final Inflater inflater = new Inflater(true); // GZIP mode
-    private final CRC32 crc32 = new CRC32();
-    private boolean checkCrcs = false;
-
-    /** Allows the caller to decide whether or not to check CRCs on when uncompressing blocks. */
-    public void setCheckCrcs(final boolean check) {
-        this.checkCrcs = check;
-    }
-
-    /**
-     * Decompress GZIP-compressed data
-     * @param uncompressedBlock must be big enough to hold decompressed output.
-     * @param compressedBlock compressed data starting at offset 0
-     * @param compressedLength size of compressed data, possibly less than the size of the buffer.
-     */
-    void unzipBlock(byte[] uncompressedBlock, byte[] compressedBlock, int compressedLength) {
-        try {
-            ByteBuffer byteBuffer = ByteBuffer.wrap(compressedBlock, 0, compressedLength);
-            byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
-
-            // Validate GZIP header
-            if (byteBuffer.get() != BlockCompressedStreamConstants.GZIP_ID1 ||
-                    byteBuffer.get() != (byte)BlockCompressedStreamConstants.GZIP_ID2 ||
-                    byteBuffer.get() != BlockCompressedStreamConstants.GZIP_CM_DEFLATE ||
-                    byteBuffer.get() != BlockCompressedStreamConstants.GZIP_FLG
-                    ) {
-                throw new SAMFormatException("Invalid GZIP header");
-            }
-            // Skip MTIME, XFL, OS fields
-            byteBuffer.position(byteBuffer.position() + 6);
-            if (byteBuffer.getShort() != BlockCompressedStreamConstants.GZIP_XLEN) {
-                throw new SAMFormatException("Invalid GZIP header");
-            }
-            // Skip blocksize subfield intro
-            byteBuffer.position(byteBuffer.position() + 4);
-            // Read ushort
-            final int totalBlockSize = (byteBuffer.getShort() & 0xffff) + 1;
-            if (totalBlockSize != compressedLength) {
-                throw new SAMFormatException("GZIP blocksize disagreement");
-            }
-
-            // Read expected size and CRD from end of GZIP block
-            final int deflatedSize = compressedLength - BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH - BlockCompressedStreamConstants.BLOCK_FOOTER_LENGTH;
-            byteBuffer.position(byteBuffer.position() + deflatedSize);
-            int expectedCrc = byteBuffer.getInt();
-            int uncompressedSize = byteBuffer.getInt();
-            inflater.reset();
-
-            // Decompress
-            inflater.setInput(compressedBlock, BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH, deflatedSize);
-            final int inflatedBytes = inflater.inflate(uncompressedBlock, 0, uncompressedSize);
-            if (inflatedBytes != uncompressedSize) {
-                throw new SAMFormatException("Did not inflate expected amount");
-            }
-
-            // Validate CRC if so desired
-            if (this.checkCrcs) {
-                crc32.reset();
-                crc32.update(uncompressedBlock, 0, uncompressedSize);
-                final long crc = crc32.getValue();
-                if ((int)crc != expectedCrc) {
-                    throw new SAMFormatException("CRC mismatch");
-                }
-            }
-        } catch (DataFormatException e)
-        {
-            throw new RuntimeException(e);
-        }
-    }
-}
diff --git a/net/sf/samtools/util/HttpUtils.java b/net/sf/samtools/util/HttpUtils.java
deleted file mode 100644
index 940e51f..0000000
--- a/net/sf/samtools/util/HttpUtils.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package net.sf.samtools.util;
-
-import java.net.URLConnection;
-import java.net.URL;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-
-/**
- * User: jrobinso
- * Date: Sep 23, 2009
- */
-public class HttpUtils {
-
-
-    public static String getETag(final URL url) {
-        URLConnection conn = null;
-        try {
-            // Create a URLConnection object for a URL
-            conn = url.openConnection();
-            conn.setReadTimeout(3000);
-            return conn.getHeaderField("ETag");
-        } catch (Exception e) {
-            e.printStackTrace();
-            return null;
-        }
-        finally {
-            if (conn != null && conn instanceof HttpURLConnection) {
-                ((HttpURLConnection) conn).disconnect();
-            }
-        }
-    }
-
-    public static String getHeaderField(final URL url, final String name) {
-        URLConnection conn = null;
-        try {
-            // Create a URLConnection object for a URL
-            conn = url.openConnection();
-            conn.setReadTimeout(3000);
-            return conn.getHeaderField(name);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            return null;
-        }
-        finally {
-            if (conn != null && conn instanceof HttpURLConnection) {
-                ((HttpURLConnection) conn).disconnect();
-            }
-        }
-    }
-
-    public static void printHeaderFields(final URL url) {
-
-        URLConnection conn = null;
-        try {
-            // Create a URLConnection object for a URL
-            conn = url.openConnection();
-            conn.setReadTimeout(3000);
-
-            for (final String name : conn.getHeaderFields().keySet()) {
-                System.out.println(name + "\t" + conn.getHeaderField(name));
-
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        finally {
-            if (conn != null && conn instanceof HttpURLConnection) {
-                ((HttpURLConnection) conn).disconnect();
-            }
-        }
-    }
-
-    public static boolean resourceAvailable(final URL url) {
-        URLConnection conn = null;
-        try {
-            // Create a URLConnection object for a URL
-            conn = url.openConnection();
-            conn.setReadTimeout(3000);
-            return conn.getHeaderField("ETag") != null;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-        finally {
-            if (conn != null && conn instanceof HttpURLConnection) {
-                ((HttpURLConnection) conn).disconnect();
-            }
-        }
-    }
-
-    public static void main(final String[] args) throws MalformedURLException {
-        //printHeaderFields(new URL(
-        //        "http://www.broadinstitute.org/igvdata/1KG/DCC_merged/freeze5/NA12891.pilot2.SLX.bam"));
-        System.out.println(getETag(new URL(
-                 "http://www.broadinstitute.org/igvdata/test/sam/303KY.8.paired1.bam.tdf")));
-        System.out.println(resourceAvailable(new URL(
-                "http://www.broadinstitute.org/igvdata/test/sam/303KY.8.paired1.bam.tdf")));
-
-
-    }
-}
diff --git a/net/sf/samtools/util/IOUtil.java b/net/sf/samtools/util/IOUtil.java
deleted file mode 100644
index 9665c68..0000000
--- a/net/sf/samtools/util/IOUtil.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2009 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package net.sf.samtools.util;
-
-
-import net.sf.samtools.Defaults;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.File;
-
-/**
- * Miscellaneous stateless static IO-oriented methods.
- */
-public class IOUtil {
-    /**
-     * @deprecated Use Defaults.BUFFER_SIZE instead.
-     */
-    @Deprecated public static final int STANDARD_BUFFER_SIZE = Defaults.BUFFER_SIZE;
-
-    public static final long ONE_GB   = 1024 * 1024 * 1024;
-    public static final long TWO_GBS  = 2 * ONE_GB;
-    public static final long FIVE_GBS = 5 * ONE_GB;
-
-    /**
-     * Wrap the given stream in a BufferedInputStream, if it isn't already wrapper
-     * @param stream stream to be wrapped
-     * @return A BufferedInputStream wrapping stream, or stream itself if stream instanceof BufferedInputStream.
-     */
-    public static BufferedInputStream toBufferedStream(final InputStream stream) {
-        if (stream instanceof BufferedInputStream) {
-            return (BufferedInputStream) stream;
-        } else {
-            return new BufferedInputStream(stream, STANDARD_BUFFER_SIZE);
-        }
-    }
-
-    /**
-     * Delete a list of files, and write a warning message if one could not be deleted.
-     * @param files Files to be deleted.
-     */
-    public static void deleteFiles(final File... files) {
-        for (final File f : files) {
-            if (!f.delete()) {
-                System.err.println("Could not delete file " + f);
-            }
-        }
-    }
-
-    public static void deleteFiles(final Iterable<File> files) {
-        for (final File f : files) {
-            if (!f.delete()) {
-                System.err.println("Could not delete file " + f);
-            }
-        }
-    }
-
-
-    /**
-     * @return true if the path is not a device (e.g. /dev/null or /dev/stdin), and is not
-     * an existing directory.  I.e. is is a regular path that may correspond to an existing
-     * file, or a path that could be a regular output file.
-     */
-    public static boolean isRegularPath(final File file) {
-        return !file.exists() || file.isFile();
-    }
-
-    /**
-     * Creates a new tmp file on one of the available temp filesystems, registers it for deletion
-     * on JVM exit and then returns it.
-     */
-    public static File newTempFile(final String prefix, final String suffix,
-                                   final File[] tmpDirs, final long minBytesFree) throws IOException {
-        File f = null;
-
-        for (int i=0; i<tmpDirs.length; ++i) {
-            if (tmpDirs[i].getUsableSpace() > minBytesFree || i == tmpDirs.length-1) {
-                f = File.createTempFile(prefix, suffix, tmpDirs[i]);
-                f.deleteOnExit();
-                break;
-            }
-        }
-
-        return f;
-    }
-
-    /** Creates a new tmp file on one of the potential filesystems that has at least 5GB free. */
-    public static File newTempFile(final String prefix, final String suffix,
-                                   final File[] tmpDirs) throws IOException {
-        return newTempFile(prefix, suffix, tmpDirs, FIVE_GBS);
-    }
-
-
-    /** Returns a default tmp directory. */
-    public static File getDefaultTmpDir() {
-        final String user = System.getProperty("user.name");
-        final String tmp = System.getProperty("java.io.tmpdir");
-
-        if (tmp.endsWith("/" + user)) return new File(tmp);
-        else return new File(tmp, user);
-    }
-}
diff --git a/net/sf/samtools/util/RuntimeEOFException.java b/net/sf/samtools/util/RuntimeEOFException.java
deleted file mode 100644
index ae4d70d..0000000
--- a/net/sf/samtools/util/RuntimeEOFException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2009 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package net.sf.samtools.util;
-
-import net.sf.samtools.SAMException;
-
-/**
- * Thrown by various codecs to indicate EOF without having to clutter the API with throws clauses
- */
-public class RuntimeEOFException extends SAMException {
-    public RuntimeEOFException() {
-    }
-
-    public RuntimeEOFException(final String s) {
-        super(s);
-    }
-
-    public RuntimeEOFException(final String s, final Throwable throwable) {
-        super(s, throwable);
-    }
-
-    public RuntimeEOFException(final Throwable throwable) {
-        super(throwable);
-    }
-}
diff --git a/net/sf/samtools/util/RuntimeIOException.java b/net/sf/samtools/util/RuntimeIOException.java
deleted file mode 100644
index 6c2f5ad..0000000
--- a/net/sf/samtools/util/RuntimeIOException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2009 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package net.sf.samtools.util;
-
-import net.sf.samtools.SAMException;
-
-/**
- * Thrown by various IO classes to indicate IOException without having to clutter the API with throws clauses
- */
-public class RuntimeIOException extends SAMException {
-    public RuntimeIOException() {
-    }
-
-    public RuntimeIOException(final String s) {
-        super(s);
-    }
-
-    public RuntimeIOException(final String s, final Throwable throwable) {
-        super(s, throwable);
-    }
-
-    public RuntimeIOException(final Throwable throwable) {
-        super(throwable);
-    }
-}
diff --git a/net/sf/samtools/util/SeekableBufferedStream.java b/net/sf/samtools/util/SeekableBufferedStream.java
deleted file mode 100644
index 50d0087..0000000
--- a/net/sf/samtools/util/SeekableBufferedStream.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2009 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package net.sf.samtools.util;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-
-/**
- * A wrapper class to provide buffered read access to a SeekableStream.  Just wrapping such a stream with
- * a BufferedInputStream will not work as it does not support seeking.  In this implementation a
- * seek call is delegated to the wrapped stream, and the buffer reset. 
- */
-public class SeekableBufferedStream extends SeekableStream {
-
-    public static final int DEFAULT_BUFFER_SIZE = 512000;
-
-    final private int bufferSize;
-    final SeekableStream wrappedStream;
-    BufferedInputStream bufferedStream;
-    long position;
-
-    public SeekableBufferedStream(SeekableStream httpStream, int bufferSize) {
-        this.bufferSize = bufferSize;
-        this.wrappedStream = httpStream;
-        this.position = 0;
-        bufferedStream = new BufferedInputStream(wrappedStream, bufferSize);
-    }
-    public SeekableBufferedStream(SeekableStream httpStream) {
-        this(httpStream, DEFAULT_BUFFER_SIZE);
-    }
-
-    public long length() {
-        return wrappedStream.length();
-    }
-
-    public void seek(long position) throws IOException {
-        this.position = position;
-        wrappedStream.seek(position);
-        bufferedStream = new BufferedInputStream(wrappedStream, bufferSize);
-    }
-
-    public int read() throws IOException {
-        int b = bufferedStream.read();
-        position++;
-        return b;
-    }
-
-    public int read(byte[] buffer, int offset, int length) throws IOException {
-        int nBytesRead = bufferedStream.read(buffer, offset, length);
-        if (nBytesRead > 0) {
-            position += nBytesRead;
-        }
-        return nBytesRead;
-    }
-
-    public void close() throws IOException {
-        wrappedStream.close();
-    }
-
-    public boolean eof() throws IOException {
-        return position >= wrappedStream.length();
-    }
-
-    @Override
-    public String getSource() {
-        return wrappedStream.getSource();
-    }
-}
diff --git a/net/sf/samtools/util/SeekableFileStream.java b/net/sf/samtools/util/SeekableFileStream.java
deleted file mode 100644
index ef4db1d..0000000
--- a/net/sf/samtools/util/SeekableFileStream.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package net.sf.samtools.util;
-
-import java.io.*;
-
-/**
- *
- * @author jrobinso
- */
-public class SeekableFileStream extends SeekableStream {
-
-    File file;
-    RandomAccessFile fis;
-
-    public SeekableFileStream(final File file) throws FileNotFoundException {
-        this.file = file;
-        fis = new RandomAccessFile(file, "r");
-    }
-
-    public long length() {
-        return file.length();
-    }
-
-    public boolean eof() throws IOException {
-        return fis.length() == fis.getFilePointer();
-    }
-
-    public void seek(final long position) throws IOException {
-        fis.seek(position);
-    }
-    
-    public int read(final byte[] buffer, final int offset, final int length) throws IOException {
-        if (length < 0) {
-            throw new IndexOutOfBoundsException();
-        }
-        int n = 0;
-        while (n < length) {
-            final int count = fis.read(buffer, offset + n, length - n);
-            if (count < 0) {
-              if (n > 0) {
-                return n;
-              } else {
-                return count;
-              }
-            }
-            n += count;
-        }
-        return n;
-
-    }
-
-
-    public void close() throws IOException {
-        fis.close();
-
-    }
-
-    public int read() throws IOException {
-        return fis.read();  
-    }
-
-    @Override
-    public String getSource() {
-        return file.getAbsolutePath();
-    }
-}
\ No newline at end of file
diff --git a/net/sf/samtools/util/SeekableHTTPStream.java b/net/sf/samtools/util/SeekableHTTPStream.java
deleted file mode 100644
index 1e240f1..0000000
--- a/net/sf/samtools/util/SeekableHTTPStream.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package net.sf.samtools.util;
-
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.Proxy;
-import java.net.URL;
-
-/**
- * @author jrobinso
- */
-public class SeekableHTTPStream extends SeekableStream {
-
-    private long position = 0;
-    private long contentLength = -1;
-    private final URL url;
-    private final Proxy proxy;
-
-    public SeekableHTTPStream(final URL url) {
-        this(url, null);
-
-    }
-
-    public SeekableHTTPStream(final URL url, Proxy proxy) {
-
-        this.proxy = proxy;
-        this.url = url;
-
-        // Try to get the file length
-        final String contentLengthString = HttpUtils.getHeaderField(url, "Content-Length");
-        if (contentLengthString != null) {
-            try {
-                contentLength = Long.parseLong(contentLengthString);
-            }
-            catch (NumberFormatException ignored) {
-                System.err.println("WARNING: Invalid content length (" + contentLengthString + "  for: " + url);
-                contentLength = -1;
-            }
-        }
-
-    }
-
-    public long length() {
-        return contentLength;
-    }
-
-    public boolean eof() throws IOException {
-        return position >= contentLength;
-    }
-
-    public void seek(final long position) {
-        this.position = position;
-    }
-
-    public int read(byte[] buffer, int offset, int len) throws IOException {
-
-        if (offset < 0 || len < 0 || (offset + len) > buffer.length) {
-            throw new IndexOutOfBoundsException("Offset="+offset+",len="+len+",buflen="+buffer.length);
-        }
-        if (len == 0) {
-            return 0;
-        }
-
-        HttpURLConnection connection = null;
-        InputStream is = null;
-        String byteRange = "";
-        int n = 0;
-        try {
-            connection = proxy == null ?
-                    (HttpURLConnection) url.openConnection() :
-                    (HttpURLConnection) url.openConnection(proxy);
-
-            long endRange = position + len - 1;
-            // IF we know the total content length, limit the end range to that.
-            if (contentLength > 0) {
-                endRange = Math.min(endRange, contentLength);
-            }
-            byteRange = "bytes=" + position + "-" + endRange;
-            connection.setRequestProperty("Range", byteRange);
-
-            is = connection.getInputStream();
-
-            while (n < len) {
-                int count = is.read(buffer, offset + n, len - n);
-                if (count < 0) {
-                    if (n == 0) {
-                        return -1;
-                    } else {
-                        break;
-                    }
-                }
-                n += count;
-            }
-
-            position += n;
-
-            return n;
-
-        }
-
-        catch (IOException e) {
-            // THis is a bit of a hack, but its not clear how else to handle this.  If a byte range is specified
-            // that goes past the end of the file the response code will be 416.  The MAC os translates this to
-            // an IOException with the 416 code in the message.  Windows translates the error to an EOFException.
-            //
-            //  The BAM file iterator  uses the return value to detect end of file (specifically looks for n == 0).
-            if (e.getMessage().contains("416") || (e instanceof EOFException)) {
-                if (n < 0) {
-                    return -1;
-                } else {
-                    position += n;
-                    // As we are at EOF, the contentLength and position are by definition =
-                    contentLength = position;
-                    return n;
-                }
-            } else {
-                throw e;
-            }
-
-        }
-
-        finally {
-            if (is != null) {
-                is.close();
-            }
-            if (connection != null) {
-                connection.disconnect();
-            }
-        }
-    }
-
-
-    public void close() throws IOException {
-        // Nothing to do
-    }
-
-
-    public int read() throws IOException {
-    	byte []tmp=new byte[1];
-    	read(tmp,0,1);
-    	return (int) tmp[0] & 0xFF; 
-    }
-
-    @Override
-    public String getSource() {
-        return url.toString();
-    }
-}
\ No newline at end of file
diff --git a/net/sf/samtools/util/SeekableStream.java b/net/sf/samtools/util/SeekableStream.java
deleted file mode 100644
index c0619f0..0000000
--- a/net/sf/samtools/util/SeekableStream.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * The Broad Institute
- * SOFTWARE COPYRIGHT NOTICE AGREEMENT
- * This is copyright (2007-2009) by the Broad Institute/Massachusetts Institute
- * of Technology.  It is licensed to You under the Gnu Public License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *    http://www.opensource.org/licenses/gpl-2.0.php
- *
- * This software is supplied without any warranty or guaranteed support
- * whatsoever. Neither the Broad Institute nor MIT can be responsible for its
- * use, misuse, or functionality.
- */
-package net.sf.samtools.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-public abstract class SeekableStream extends InputStream {
-
-    public abstract long length();
-
-    public abstract void seek(long position) throws IOException;
-
-    public abstract int read(byte[] buffer, int offset, int length) throws IOException;
-
-    public abstract void close() throws IOException;
-
-    public abstract boolean eof() throws IOException;
-
-    /**
-     * @return String representation of source (e.g. URL, file path, etc.), or null if not available.
-     * Should end with .bam if not null.
-     */
-    public abstract String getSource();
-}
\ No newline at end of file
diff --git a/net/sf/samtools/util/StringUtil.java b/net/sf/samtools/util/StringUtil.java
deleted file mode 100644
index 55fe342..0000000
--- a/net/sf/samtools/util/StringUtil.java
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2009 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package net.sf.samtools.util;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Arrays;
-
-/**
- * Grab-bag of stateless String-oriented utilities.
- */
-public class StringUtil {
-    private static final byte UPPER_CASE_OFFSET = 'A' - 'a';
-
-    /**
-     * @param <T> the type parameter
-     * @param separator String to interject between each string in strings arg
-     * @param objs List of objs to be joined
-     * @return String that concatenates the result of each item's to String method for all items in objs, with separator between each of them.
-     */
-    public static <T> String join(final String separator, final Collection<T> objs) {
-        if (objs.isEmpty()) {
-            return "";
-        }
-        boolean notFirst = false;
-        final StringBuilder ret = new StringBuilder();
-        for (final Object obj : objs) {
-            if(notFirst) {
-                ret.append(separator);
-            }
-            ret.append(obj.toString());
-            notFirst = true;
-        }
-        return ret.toString();
-    }
-
-    public static <T> String join(final String separator, final T... objs) {
-        final List<T> values = Arrays.asList(objs);
-        return join(separator, values);
-    }
-
-
-    /**
-     * Split the string into tokens separated by the given delimiter.  Profiling has
-     * revealed that the standard string.split() method typically takes {@code > 1/2}
-     * the total time when used for parsing ascii files.
-     * Note that if tokens arg is not large enough to all the tokens in the string, excess tokens are discarded.
-     *
-     * @param aString  the string to split
-     * @param tokens an array to hold the parsed tokens
-     * @param delim  character that delimits tokens
-     * @return the number of tokens parsed
-     */
-    public static int split(final String aString, final String[] tokens, final char delim) {
-
-        final int maxTokens = tokens.length;
-        int nTokens = 0;
-        int start = 0;
-        int end = aString.indexOf(delim);
-        if(end < 0) {
-            tokens[nTokens++] = aString;
-            return nTokens;
-        }
-        while ((end > 0) && (nTokens < maxTokens))
-        {
-            tokens[nTokens++] = aString.substring(start, end);
-            start = end + 1;
-            end = aString.indexOf(delim, start);
-
-        }
-        // Add the trailing string,  if there is room and if it is not empty.
-        if (nTokens < maxTokens)
-        {
-            final String trailingString = aString.substring(start);
-            if (trailingString.length() > 0)
-            {
-                tokens[nTokens++] = trailingString;
-            }
-        }
-        return nTokens;
-    }
-
-    /**
-     * Split the string into tokens separated by the given delimiter.  Profiling has
-     * revealed that the standard string.split() method typically takes {@code > 1/2}
-     * the total time when used for parsing ascii files.
-     * Note that the string is split into no more elements than tokens arg will hold, so the final tokenized
-     * element may contain delimiter chars.
-     *
-     * @param aString  the string to split
-     * @param tokens an array to hold the parsed tokens
-     * @param delim  character that delimits tokens
-     * @return the number of tokens parsed
-     */
-    public static int splitConcatenateExcessTokens(final String aString, final String[] tokens, final char delim) {
-
-        final int maxTokens = tokens.length;
-        int nTokens = 0;
-        int start = 0;
-        int end = aString.indexOf(delim);
-        if(end < 0) {
-            tokens[nTokens++] = aString;
-            return nTokens;
-        }
-        while ((end > 0) && (nTokens < maxTokens - 1))
-        {
-            tokens[nTokens++] = aString.substring(start, end);
-            start = end + 1;
-            end = aString.indexOf(delim, start);
-
-        }
-        // Add the trailing string,  if it is not empty.
-        final String trailingString = aString.substring(start);
-        if (trailingString.length() > 0)
-        {
-            tokens[nTokens++] = trailingString;
-        }
-        return nTokens;
-    }
-
-    /**
-     * @param b ASCII character
-     * @return lowercase version of arg if it was uppercase, otherwise returns arg
-     */
-    public static byte toLowerCase(final byte b) {
-        if (b < 'A' || b > 'Z') {
-            return b;
-        }
-        return (byte)(b - UPPER_CASE_OFFSET);
-    }
-
-    /**
-     * @param b ASCII character
-     * @return uppercase version of arg if it was lowercase, otherwise returns arg
-     */
-    public static byte toUpperCase(final byte b) {
-        if (b < 'a' || b > 'z') {
-            return b;
-        }
-        return (byte)(b + UPPER_CASE_OFFSET);
-    }
-
-    /**
-     * Converts in place all lower case letters to upper case in the byte array provided.
-     */
-    public static void toUpperCase(final byte[] bytes) {
-        final int length = bytes.length;
-        for (int i=0; i<length; ++i) {
-            if (bytes[i] >= 'a' && bytes[i] <= 'z') {
-                bytes[i] = (byte) (bytes[i] + UPPER_CASE_OFFSET);
-            }
-        }
-    }
-
-
-    /**
-     * Checks that a String doesn't contain one or more characters of interest.
-     *
-     * @param illegalChars the String to check
-     * @param chars the characters to check for
-     * @return String the input String for convenience
-     * @throws IllegalArgumentException if the String contains one or more of the characters
-     */
-    public static String assertCharactersNotInString(final String illegalChars, final char... chars) {
-        for (final char illegalChar : illegalChars.toCharArray()) {
-            for (final char ch: chars) {
-                if (illegalChar == ch) {
-                    throw new IllegalArgumentException("Supplied String contains illegal character '" + illegalChar + "'.");
-                }
-            }
-        }
-
-        return illegalChars;
-    }
-
-    /**
-     * Return input string with newlines inserted to ensure that all lines
-     * have {@code length <= maxLineLength}.  if a word is too long, it is simply broken
-     * at maxLineLength.  Does not handle tabs intelligently (due to implementer laziness).
-     */
-    public static String wordWrap(final String s, final int maxLineLength) {
-        final String[] lines = s.split("\n");
-        final StringBuilder sb = new StringBuilder();
-        for (final String line: lines) {
-            if (sb.length() > 0) {
-                sb.append("\n");
-            }
-            sb.append(wordWrapSingleLine(line, maxLineLength));
-        }
-        if (s.endsWith("\n")) {
-            sb.append("\n");
-        }
-        return sb.toString();
-    }
-
-    public static String wordWrapSingleLine(final String s, final int maxLineLength) {
-        if (s.length() <= maxLineLength) {
-            return s;
-        }
-        final StringBuilder sb = new StringBuilder();
-        int startCopyFrom = 0;
-        while (startCopyFrom < s.length()) {
-            int lastSpaceIndex = startCopyFrom;
-            int i;
-            // Find break point (if it exists)
-            for (i = startCopyFrom; i < s.length() && i - startCopyFrom < maxLineLength; ++i) {
-                if (Character.isWhitespace(s.charAt(i))) {
-                    lastSpaceIndex = i;
-                }
-            }
-            if (i - startCopyFrom < maxLineLength) {
-                lastSpaceIndex = i;
-            }
-            // Include any trailing whitespace
-            for (; lastSpaceIndex < s.length() && Character.isWhitespace(s.charAt(lastSpaceIndex)); ++lastSpaceIndex) {}
-            if (sb.length() > 0) {
-                sb.append("\n");
-            }
-            // Handle situation in which there is no word break.  Just break the word in the middle.
-            if (lastSpaceIndex == startCopyFrom) {
-                lastSpaceIndex = i;
-            }
-            sb.append(s.substring(startCopyFrom, lastSpaceIndex));
-            startCopyFrom = lastSpaceIndex;
-        }
-        return sb.toString();
-    }
-
-
-    public static String intValuesToString(final int[] intVals) {
-        final StringBuilder sb = new StringBuilder(intVals.length);
-        if(intVals.length > 0) {
-            sb.append(String.valueOf(intVals[0]));
-            for(int i = 1; i < intVals.length; i++) {
-                sb.append(", ");
-                sb.append(String.valueOf(intVals[i]));
-            }
-        }
-
-        return sb.toString();
-    }
-
-    public static String intValuesToString(final short[] shortVals) {
-        final StringBuilder sb = new StringBuilder(shortVals.length);
-        if(shortVals.length > 0) {
-            sb.append(String.valueOf(shortVals[0]));
-            for(int i = 1; i < shortVals.length; i++) {
-                sb.append(", ");
-                sb.append(String.valueOf(shortVals[i]));
-            }
-        }
-
-        return sb.toString();
-    }
-
-    ////////////////////////////////////////////////////////////////////
-    // The following methods all convert btw bytes and Strings, without
-    // using the Java character set mechanism.
-    ////////////////////////////////////////////////////////////////////
-
-    public static String bytesToString(final byte[] data) {
-        if (data == null) {
-            return null;
-        }
-        return bytesToString(data, 0, data.length);
-    }
-
-    @SuppressWarnings("deprecation")
-    public static String bytesToString(final byte[] buffer, final int offset, final int length) {
-/*
-        The non-deprecated way, that requires allocating char[]
-        final char[] charBuffer = new char[length];
-        for (int i = 0; i < length; ++i) {
-            charBuffer[i] = (char)buffer[i+offset];
-        }
-        return new String(charBuffer);
-*/
-        return new String(buffer, 0, offset, length);
-    }
-
-    @SuppressWarnings("deprecation")
-    public static byte[] stringToBytes(final String s) {
-/*
-        The non-deprecated way, that requires allocating char[]
-        final byte[] byteBuffer = new byte[s.length()];
-        final char[] charBuffer = s.toCharArray();
-        for (int i = 0; i < charBuffer.length; ++i) {
-            byteBuffer[i] = (byte)(charBuffer[i] & 0xff);
-        }
-        return byteBuffer;
-*/
-        final byte[] byteBuffer = new byte[s.length()];
-        s.getBytes(0, byteBuffer.length, byteBuffer, 0);
-        return byteBuffer;
-    }
-
-    @SuppressWarnings("deprecation")
-    public static byte[] stringToBytes(final String s, final int offset, final int length) {
-        final byte[] byteBuffer = new byte[length];
-        s.getBytes(offset, offset + length, byteBuffer, 0);
-        return byteBuffer;
-    }
-
-    // This method might more appropriately live in BinaryCodec, but all the byte <=> char conversion
-    // should be in the same place.
-    public static String readNullTerminatedString(final BinaryCodec binaryCodec) {
-        final StringBuilder ret = new StringBuilder();
-        for (byte b = binaryCodec.readByte(); b != 0; b = binaryCodec.readByte()) {
-            ret.append((char)(b & 0xff));
-        }
-        return ret.toString();
-    }
-
-    /**
-     * Convert chars to bytes merely by casting
-     * @param chars input chars
-     * @param charOffset where to start converting from chars array
-     * @param length how many chars to convert
-     * @param bytes where to put the converted output
-     * @param byteOffset where to start writing the converted output.
-     */
-    public static void charsToBytes(final char[] chars, final int charOffset, final int length,
-                                    final byte[] bytes, final int byteOffset) {
-        for (int i = 0; i < length; ++i) {
-            bytes[byteOffset + i] = (byte)chars[charOffset + i];
-        }
-    }
-
-    /**
-     * Convert ASCII char to byte.
-     */
-    public static byte charToByte(final char c) {
-        return (byte)c;
-    }
-
-    /**
-     * Convert ASCII byte to ASCII char.
-     */
-    public static char byteToChar(final byte b) {
-        return (char)(b & 0xff);
-    }
-
-    /**
-     * Convert a byte array into a String hex representation.
-     * @param data Input to be converted.
-     * @return String twice as long as data.length with hex representation of data.
-     */
-    public static String bytesToHexString(final byte[] data) {
-        final char[] chars = new char[2 * data.length];
-        for (int i = 0; i < data.length; i++) {
-            final byte b = data[i];
-            chars[2*i] = toHexDigit((b >> 4) & 0xF);
-            chars[2*i+1] = toHexDigit(b & 0xF);
-        }
-        return new String(chars);
-    }
-
-    /**
-     * Convert a String containing hex characters into an array of bytes with the binary representation
-     * of the hex string
-     * @param s Hex string.  Length must be even because each pair of hex chars is converted into a byte.
-     * @return byte array with binary representation of hex string.
-     * @throws NumberFormatException
-     */
-    public static byte[] hexStringToBytes(final String s)  throws NumberFormatException {
-        if (s.length() % 2 != 0) {
-            throw new NumberFormatException("Hex representation of byte string does not have even number of hex chars: " + s);
-        }
-        final byte[] ret = new byte[s.length() / 2];
-        for (int i = 0; i < ret.length; ++i) {
-            ret[i] = (byte) ((fromHexDigit(s.charAt(i * 2)) << 4) | fromHexDigit(s.charAt(i * 2 + 1)));
-        }
-        return ret;
-    }
-
-    public static char toHexDigit(final int value) {
-        return (char) ((value < 10) ? ('0' + value) : ('A' + value - 10));
-    }
-
-    public static int fromHexDigit(final char c) throws NumberFormatException {
-        final int ret = Character.digit(c, 16);
-        if (ret == -1) {
-            throw new NumberFormatException("Not a valid hex digit: " + c);
-        }
-        return ret;
-    }
-
-    /**
-     * Reverse the given string.  Does not check for null.
-     * @param s String to be reversed.
-     * @return New string that is the reverse of the input string.
-     */
-    public static String reverseString(final String s) {
-        final StringBuilder sb = new StringBuilder(s);
-        sb.reverse();
-        return sb.toString();
-    }
-
-    /**
-     * <p>Checks if a String is whitespace, empty ("") or null.</p>
-     *
-     * <pre>
-     * StringUtils.isBlank(null)      = true
-     * StringUtils.isBlank("")        = true
-     * StringUtils.isBlank(" ")       = true
-     * StringUtils.isBlank("sam")     = false
-     * StringUtils.isBlank("  sam  ") = false
-     * </pre>
-     *
-     * @param str  the String to check, may be null
-     * @return {@code true} if the String is null, empty or whitespace
-     */
-    public static boolean isBlank(String str) {
-        int strLen;
-        if (str == null || (strLen = str.length()) == 0) {
-            return true;
-        }
-        for (int i = 0; i < strLen; i++) {
-            if (!Character.isWhitespace(str.charAt(i)) ) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-     /* <p>Generates a string of one character to a specified length</p>
-     *
-     * @param c  the Character to repeat
-     * @param repeatNumber the number of times to repeat the character
-     * @return String with the character c repeated repeatNumber times
-     */
-    public static String repeatCharNTimes(char c, int repeatNumber) {
-        char[] output = new char[repeatNumber];
-        Arrays.fill(output, c);
-        return String.valueOf(output);
-    }
-
-}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/beagle.git



More information about the debian-med-commit mailing list