*/
public synchronized long fgetpos() throws IOException, PipeException, InvalidValueException, BadDescriptorException {
// Correct position for read / write buffering (we could invalidate, but expensive)
if (descriptor.isSeekable()) {
FileChannel fileChannel = (FileChannel)descriptor.getChannel();
long pos = fileChannel.position();
// Adjust for buffered data
if (reading) {
pos -= buffer.remaining();
return pos - (pos > 0 && ungotc != -1 ? 1 : 0);
} else {