title: Read/Write to linux Pipe using Java
body: <p>My query is on what is the best way to read / write to a linux Pipe in Java? I already am using the java.io.RandomAccessFile like</p>
  
  <pre><code>   RandomAccessFile file = new RandomAccessFile("/dev/zap/16", "rw");
  </code></pre>
  
  <p>and then passing it to worker thread which reads it after every 2ms as</p>
  
  <pre><code>  byte[] buffer = new byte[16];
    file.read(buffer);
  </code></pre>
  
  <p>It does read it from Pipe, but I suspect that some bytes are overwritten. Do you know how linux (ubuntu) handles the buffer for pipe's?</p>