/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Portions Copyright 2012 Jens Elkner.
*/
/**
* An UTF-8 OutputStreamWriter used to write Xref files.
*
* @author Jens Elkner
* @version $Revision$
*/
private long count;
/**
* Creates an uncompressed xref output stream by creating/overwriting the
* file with the given name.
* @param genre the genre of the data to be written.
* @throws IOException
*/
}
/**
* Creates an [un]compressed xref output stream by creating/overwriting the
* file with the given name.
* @param genre the genre of the data to be written.
* @param compress if {@code true} written data gets compressed.
* @throws IOException
*/
}
/**
* Creates an uncompressed xref output stream by creating/overwriting the
* given file.
*
* @param file file to write
* @param genre the genre of the data to be written.
* @throws IOException
*/
}
throw new IllegalArgumentException("null is not allowed");
}
}
}
}
public void close() {
// prevent wrapper streams from closing it
}
}
/**
* Creates an [un]compressed xref output stream by creating/overwriting the
* given file.
*
* @param file file to write
* @param genre the genre of the data to be written.
* @param compress if {@code true} written data gets compressed.
* @throws IOException
* @throws FileNotFoundException
* @see FileOutputStream
*/
super(file);
}
/**
* Just wraps the given writer. {@link #close()} on this instance gets
* ignored and thus no header will be written or updated.
* @param out writer to wrap.
*/
super(new Object());
}
/**
* Get the number of bytes written to the output stream.
* @return a number >= 0
* @see FileChannel#position()
*/
public long getCount() {
return count;
}
/**
* Get the file this instance is writing to.
* @return {@code null} if this instance wraps another writer, the file
* used to create this instance otherwise.
*/
}
/**
* {@inheritDoc}
*/
}
/**
* {@inheritDoc}
*/
}
/**
* {@inheritDoc}
*/
}
}
/**
* Remember the number of characters currently written to the underlying
* output stream. NOTE: This method is unsynchronized and thus may return
* an unexpected value if characters are written concurrently!
* @return the value of {@link #getCount()}
*/
public long mark() {
return mark;
}
/**
* Get the number of characters written to the underlying
* output stream at the last time when {@link #mark()} was called.
* @return {@code -1} if {@code mark()} has never been called, otherwise
* the value the last {@code mark()} returned.
*/
public long getMark() {
return mark;
}
/**
* Set the number of lines written to this stream.
* @param lines number of lines writen.
*/
}
}
}