Q
qwertmonkey
What is missing in this code snippet to get the offsets in the underlying
FileChannel on which the MappedByteBuffer and then the CharBuffer are built?
~
CharBuffer.position() gives you the position alright, but how about wanting
to get the actual offset of certain characters in the actual data feed exposed
through the FileInputStream?
~
char c;
long lPsx;
FIS = new FileInputStream(IFl);
FileChannel FlChnl = FIS.getChannel();
MappedByteBuffer MptbChnlBfr = FlChnl.map(FileChannel.MapMode.READ_ONLY,
0, FlChnl.size());
CharBuffer cBfrUTF8 = ChrStDkdr.decode(MptbChnlBfr);
// __
while(cBfrUTF8.hasRemaining()){
c = cBfrUTF8.get();
lPsx = cBfrUTF8.position();
System.err.println("// __ |" + lPsx + "|" + c + "|" + (int)c + "|");
}
// __
FlChnl.close();
FIS.close();
~
Or do you know of any other way to basically do the same thing?
~
thanks,
lbrtchx
comp.lang.java.programmer
ffsets in a FileChannel ...
FileChannel on which the MappedByteBuffer and then the CharBuffer are built?
~
CharBuffer.position() gives you the position alright, but how about wanting
to get the actual offset of certain characters in the actual data feed exposed
through the FileInputStream?
~
char c;
long lPsx;
FIS = new FileInputStream(IFl);
FileChannel FlChnl = FIS.getChannel();
MappedByteBuffer MptbChnlBfr = FlChnl.map(FileChannel.MapMode.READ_ONLY,
0, FlChnl.size());
CharBuffer cBfrUTF8 = ChrStDkdr.decode(MptbChnlBfr);
// __
while(cBfrUTF8.hasRemaining()){
c = cBfrUTF8.get();
lPsx = cBfrUTF8.position();
System.err.println("// __ |" + lPsx + "|" + c + "|" + (int)c + "|");
}
// __
FlChnl.close();
FIS.close();
~
Or do you know of any other way to basically do the same thing?
~
thanks,
lbrtchx
comp.lang.java.programmer