Examples of ByteArrayWriter


Examples of com.maverick.util.ByteArrayWriter

     *
     * @return
     */
    public byte[] getEncoded() {
        try {
            ByteArrayWriter baw = new ByteArrayWriter();
            baw.writeString("ssh-dss");
            baw.writeBigInteger(prvkey.getParams().getP());
            baw.writeBigInteger(prvkey.getParams().getQ());
            baw.writeBigInteger(prvkey.getParams().getG());
            baw.writeBigInteger(prvkey.getX());

            return baw.toByteArray();
        } catch (IOException ioe) {
            return null;
        }
    }
View Full Code Here

Examples of com.maverick.util.ByteArrayWriter

                }

                log.debug("SSH signature is " + str);
            }

            ByteArrayWriter baw = new ByteArrayWriter();
            baw.writeString(getAlgorithmName());
            baw.writeBinaryString(decoded);

            return baw.toByteArray();
        } catch (Exception e) {
            throw new InvalidSignatureException(e);
        }
    }
View Full Code Here

Examples of com.maverick.util.ByteArrayWriter

        this.requestData = requestData;
    }

    public Request(String requestName, Object[] values) throws IOException {
        this.requestName = requestName;
        ByteArrayWriter writer = new ByteArrayWriter();
        for (int index = 0; index < values.length; index++) {
            Object value = values[index];
            if (value instanceof BigInteger) {
                writer.writeBigInteger((BigInteger) value);
            } else if (value instanceof Integer) {
                writer.writeInt(((Integer) value).intValue());
            } else if (value instanceof Long) {
                writer.writeUINT64(((Long) value).longValue());
            } else if (value instanceof Short) {
                writer.writeShort(((Short) value).shortValue());
            } else if (value instanceof Boolean) {
                writer.writeBoolean(((Boolean) value).booleanValue());
            } else if (value instanceof Date) {
                writer.writeUINT64(((Date) value).getTime());
            } else {
                writer.writeString(value.toString());
            }
        }
        requestData = writer.toByteArray();
    }
View Full Code Here

Examples of com.maverick.util.ByteArrayWriter

     * (non-Javadoc)
     *
     * @see com.maverick.multiplex.Channel#create()
     */
    public byte[] create() throws IOException {
        ByteArrayWriter baw = new ByteArrayWriter();
        baw.writeBoolean(initiator);
        baw.writeString(id);
        return baw.toByteArray();
    }
View Full Code Here

Examples of com.maverick.util.ByteArrayWriter

  public LocalForwardingChannel() {
    this(CHANNEL_TYPE);
  }
 
  public byte[] create() throws IOException {
    ByteArrayWriter msg = new ByteArrayWriter();
    msg.writeString(hostname);
    msg.writeInt(port);
   
    return msg.toByteArray();
  }
View Full Code Here

Examples of com.maverick.util.ByteArrayWriter

  /* (non-Javadoc)
   * @see com.maverick.multiplex.MultiplexChannel#create()
   */
  public byte[] create() throws IOException {

    ByteArrayWriter msg = new ByteArrayWriter();
    msg.writeString(hostname);
    msg.writeInt(port);
    return msg.toByteArray();
  }
View Full Code Here

Examples of com.maverick.util.ByteArrayWriter

      // Process destination host and port for replacement variables
      VariableReplacement r = new VariableReplacement();
      r.setLaunchSession(launchSession);
      String destHost = r.replace(tunnel.getDestination().getHost());
     
        ByteArrayWriter msg = new ByteArrayWriter();
        msg.writeString(launchSession == null ? "" : launchSession.getId());
        msg.writeInt(tunnel.getResourceId());
        msg.writeString(tunnel.getResourceName());
        msg.writeInt(tunnel.getType());
        msg.writeString(tunnel.getTransport());
        msg.writeString(tunnel.getSourceInterface());       
        msg.writeInt(tunnel.getSourcePort());
        msg.writeInt(tunnel.getDestination().getPort());
        msg.writeString(destHost);
        Request req = new Request(START_LOCAL_TUNNEL, msg.toByteArray());
        return req;

    }
View Full Code Here

Examples of com.maverick.util.ByteArrayWriter

        CoreException e = null;

        for (Tunnel tunnel : tunnels) {
            try {
                ByteArrayWriter msg = new ByteArrayWriter();
                msg.writeInt(tunnel.getResourceId());
                if (!agent.sendRequest(new Request(STOP_LOCAL_TUNNEL, msg.toByteArray()), false) && e == null) {
                    e = new TunnelException(TunnelException.AGENT_REFUSED_LOCAL_TUNNEL_STOP, (Throwable)null);
                }
            } catch (IOException ex) {
                throw new TunnelException(TunnelException.INTERNAL_ERROR, ex);
            }
View Full Code Here

Examples of com.maverick.util.ByteArrayWriter

   * @throws CoreException on any error
   */
  public int openURL(AgentTunnel agent, URL url, LaunchSession launchSession) throws CoreException {

    try {
      ByteArrayWriter msg = new ByteArrayWriter();
      msg.writeString(url.toExternalForm());
      msg.writeString(launchSession.getId());
      Request request = new Request("openURL", msg.toByteArray());
      if (agent.sendRequest(request, true)) {
        if(request.getRequestData()!=null) {
        ByteArrayReader rdr = new ByteArrayReader(request.getRequestData());
        return (int) rdr.readInt();
        }
View Full Code Here

Examples of com.maverick.util.ByteArrayWriter

    public RemoteTunnel getRemoteTunnel() {
        return remoteTunnel;
    }

    public byte[] create() throws IOException {
        ByteArrayWriter msg = new ByteArrayWriter();
        msg.writeString(launchSession == null ? "" : launchSession.getId());
        msg.writeInt(tunnel.getResourceId());
        msg.writeString(tunnel.getResourceName());
        msg.writeInt(tunnel.getType());
        msg.writeString(tunnel.getTransport());
        msg.writeString(tunnel.getSourceInterface());
        msg.writeInt(tunnel.getSourcePort());
        msg.writeInt(tunnel.getDestination().getPort());
        msg.writeString(tunnel.getDestination().getHost());
        msg.writeBoolean(false);
        return msg.toByteArray();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.