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

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

There is a newer version: 2.6.6
Show newest version
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 - 2024 Weber Informatics LLC | Privacy Policy