All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fisco.bcos.web3j.protocol.ipc.WindowsNamedPipe Maven / Gradle / Ivy

package org.fisco.bcos.web3j.protocol.ipc;

import java.io.IOException;
import java.io.RandomAccessFile;

/** Windows named pipe IO implementation for IPC. */
public class WindowsNamedPipe implements IOFacade {

  private final RandomAccessFile pipe;

  public WindowsNamedPipe(String ipcSocketPath) {
    try {
      pipe = new RandomAccessFile(ipcSocketPath, "rw");
    } catch (IOException e) {
      throw new RuntimeException("Provided file pipe cannot be opened: " + ipcSocketPath, e);
    }
  }

  @Override
  public void write(String payload) throws IOException {
    pipe.write(payload.getBytes());
  }

  @Override
  public String read() throws IOException {
    return pipe.readLine();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy