/** * @throws IOException */ 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 && hasUngotChars() ? ungotChars.length() : 0); } else { return pos + buffer.position(); } } else if (descriptor.isNull()) { return 0; } else { throw new PipeException(); } }
/** * @throws IOException */ 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 && hasUngotChars() ? ungotChars.length() : 0); } else { return pos + buffer.position(); } } else if (descriptor.isNull()) { return 0; } else { throw new PipeException(); } }
/** * @throws IOException */ public synchronized long fgetpos() throws IOException, PipeException, InvalidValueException, BadDescriptorException { // Correct position for read / write buffering (we could invalidate, but expensive) if (descriptor.isSeekable()) { SeekableByteChannel fileChannel = (SeekableByteChannel) descriptor.getChannel(); long pos = fileChannel.position(); // Adjust for buffered data if (reading) { pos -= buffer.remaining(); return pos - (pos > 0 && hasUngotChars() ? ungotChars.length() : 0); } else { return pos + buffer.position(); } } else if (descriptor.isNull()) { return 0; } else { throw new PipeException(); } }
/** * @throws IOException */ public synchronized long fgetpos() throws IOException, PipeException, InvalidValueException, BadDescriptorException { // Correct position for read / write buffering (we could invalidate, but expensive) if (descriptor.isSeekable()) { SeekableByteChannel fileChannel = (SeekableByteChannel) descriptor.getChannel(); long pos = fileChannel.position(); // Adjust for buffered data if (reading) { pos -= buffer.remaining(); return pos - (pos > 0 && hasUngotChars() ? ungotChars.length() : 0); } else { return pos + buffer.position(); } } else if (descriptor.isNull()) { return 0; } else { throw new PipeException(); } }
result.length(buf.position()); return result; } else if (descriptor.isNull()) { return new ByteList(0); } else {
result.length(buf.position()); return result; } else if (descriptor.isNull()) { return new ByteList(0); } else {
result.length(buf.position()); return result; } else if (descriptor.isNull()) { return new ByteList(0); } else {
result.length(buf.position()); return result; } else if (descriptor.isNull()) { return new ByteList(0); } else {
if (descriptor.isNull()) return RubyFixnum.zero(runtime);
if (descriptor.isNull()) return RubyFixnum.zero(runtime);