@@ -53,6 +53,7 @@ This file is part of the iText (R) project.
53
53
import java .io .Serializable ;
54
54
import java .lang .invoke .MethodHandle ;
55
55
import java .lang .reflect .Method ;
56
+ import java .nio .Buffer ;
56
57
import java .nio .BufferUnderflowException ;
57
58
import java .security .AccessController ;
58
59
import java .security .PrivilegedAction ;
@@ -100,7 +101,7 @@ public int get(long position) throws java.io.IOException {
100
101
throw new IllegalArgumentException ("Position must be less than Integer.MAX_VALUE" );
101
102
try {
102
103
103
- if (position >= byteBuffer .limit ())
104
+ if (position >= (( Buffer ) byteBuffer ) .limit ())
104
105
return -1 ;
105
106
byte b = byteBuffer .get ((int ) position );
106
107
return b & 0xff ;
@@ -120,11 +121,11 @@ public int get(long position, byte[] bytes, int off, int len) throws java.io.IOE
120
121
if (position > Integer .MAX_VALUE )
121
122
throw new IllegalArgumentException ("Position must be less than Integer.MAX_VALUE" );
122
123
123
- if (position >= byteBuffer .limit ())
124
+ if (position >= (( Buffer ) byteBuffer ) .limit ())
124
125
return -1 ;
125
126
126
127
// Not thread safe!
127
- byteBuffer .position ((int ) position );
128
+ (( Buffer ) byteBuffer ) .position ((int ) position );
128
129
int bytesFromThisBuffer = Math .min (len , byteBuffer .remaining ());
129
130
byteBuffer .get (bytes , off , bytesFromThisBuffer );
130
131
@@ -136,7 +137,7 @@ public int get(long position, byte[] bytes, int off, int len) throws java.io.IOE
136
137
* {@inheritDoc}
137
138
*/
138
139
public long length () {
139
- return byteBuffer .limit ();
140
+ return (( Buffer ) byteBuffer ) .limit ();
140
141
}
141
142
142
143
/**
0 commit comments