[android-developers] Re: How to get an interval of bytes from a file?

2011-09-16 Thread Jens
Try java.io.RandomAccessFile. Call RandomAccessFile#seek() to position the file pointer correctly and then call one or more of the read(..) methods available in the RandomAccessFile class. Or you could go balls deep and use a FileChannel, but that is about as fun as pleasuring yourself with a

[android-developers] Re: How to get an interval of bytes from a file?

2011-09-16 Thread Lidia
Thanks Jens, I already found a simple solution, to use skip() method: InputStream is = new FileInputStream(file); byte[] output = new byte[(int) bytesToRead]; is.skip(startPosition); is.read(output, 0, bytesToRead); and it seems to work good. -- You received this message because you are