title: How to get random access to a file on SD-Card by means of API presented for Lollipop?
body: <p>My application uses Java class <a href="http://developer.android.com/reference/java/io/RandomAccessFile.html" rel="noreferrer">RandomAccessFile</a> to read/write bytes to a file on SD card <strong>randomly</strong> by means of realization of <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/channels/SeekableByteChannel.html" rel="noreferrer">SeekableByteChannel</a> interface. Now I need rewrite it for Android 5.0 with new Lollipop API. </p>
  
  <p>I have found <a href="https://developer.android.com/guide/topics/providers/document-provider.html" rel="noreferrer">the only way</a> to read:</p>
  
  <pre><code>InputStream inputStream = getContentResolver().openInputStream(uri);
  </code></pre>
  
  <p>and write: </p>
  
  <pre><code>ParcelFileDescriptor pfd = getActivity().getContentResolver().openFileDescriptor(uri, "w");
  FileOutputStream fileOutputStream = new FileOutputStream(pfd.getFileDescriptor());
  </code></pre>
  
  <p>from/to a file in new API.</p>
  
  <p>I would like to have an ability to set channel in some <strong>random</strong> position and read/write bytes to that position. Is it possible to do that in new SDK 21? Does new SDK imply this way obtaining of channels:</p>
  
  <pre><code>FieInputChannel fieInputChannel = fileInputStream.getChannel();
  FieOutputChannel fieOutputChannel = fileOutputStream.getChannel();
  </code></pre>
  
  <p>or some other approach?</p>