@Override public long position() throws IOException { if (repositionableStream != null) return repositionableStream.position() + pos; else if (measurableStream != null) return measurableStream.position() + pos; else if (fileChannel != null) return fileChannel.position() + pos; else throw new UnsupportedOperationException("position() can only be called if the underlying byte stream implements the MeasurableStream or RepositionableStream interface or if the getChannel() method of the underlying byte stream exists and returns a FileChannel"); }