Examples of ByteArrayReader


Examples of com.maverick.util.ByteArrayReader

  /* (non-Javadoc)
   * @see com.maverick.multiplex.MultiplexChannel#open(int, byte[])
   */
  public byte[] open(byte[] data) throws IOException {
    ByteArrayReader reader = new ByteArrayReader(data);
    hostname = reader.readString();
    port = (int)reader.readInt();

    socket = new Socket(hostname, port);

    return null;
  }
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

            // The agent keeps track of 'local' tunnels

            Request request = new Request(ACTIVE_LOCAL_TUNNELS);
            if (tunnel.sendRequest(request, true) && request.getRequestData()!=null) {

                ByteArrayReader reader = new ByteArrayReader(request.getRequestData());
                int count = (int) reader.readInt();
                for (int i = 0; i < count; i++) {
                    activeTunnelIds.add(new Integer((int) reader.readInt()));
                }
            }

            // The server keeps track of 'remote' tunnels
            Collection<RemoteTunnel> activeRemoteTunnels = RemoteTunnelManagerFactory.getInstance().getRemoteTunnels(session);
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

  public boolean processRequest(Request request, MultiplexedConnection connection) {
    AgentTunnel agent = (AgentTunnel) connection;
    if (request.getRequestName().equals(SETUP_AND_LAUNCH_TUNNEL) && request.getRequestData()!=null) {
      try {
        ByteArrayReader reader = new ByteArrayReader(request.getRequestData());
        int id = (int)reader.readInt();
        Tunnel resource = (Tunnel)TunnelPlugin.SSL_TUNNEL_RESOURCE_TYPE.getResourceById(id);
        if (resource == null) {
          throw new Exception("No resource with ID " + id);
        }
        Policy policy = LaunchSessionManager.getLaunchRequestPolicy(null, agent.getSession(), resource);
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

      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();
        }
      }

    } catch (Exception e) {
      throw new CoreException(0, "", e);
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

   */
  @Override
  public byte[] open(byte[] data) throws IOException, ChannelOpenException {

    try {
      ByteArrayReader reader = new ByteArrayReader(data);
      name = reader.readString();
      launchId = reader.readString();
      filename = reader.readString();

      LaunchSession launchSession = LaunchSessionFactory.getInstance().getLaunchSession(launchId);
      if (launchSession == null) {
        throw new ChannelOpenException(ChannelOpenException.CHANNEL_REFUSED, "No launch session with ID " + launchId + ", cannot read file " + filename + " for " + name);
      }
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

    AgentTunnel agent = (AgentTunnel) connection;
    if (request.getRequestName().equals(GET_RESOURCES)) {
      try {
        if(request.getRequestData()!=null) {
            // Read the resource type requested.
          ByteArrayReader bar = new ByteArrayReader(request.getRequestData());
          int resourceTypeId = (int)bar.readInt();
          ResourceType<?> resourceType = PolicyDatabaseFactory.getInstance().getResourceType(resourceTypeId);
          if(resourceType == null) {
            throw new Exception("Request for list of resources of an unknown type (" + resourceTypeId + ")");
          }   
         
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

     *
     * @see com.maverick.multiplex.Channel#open(byte[])
     */
    public byte[] open(byte[] data) throws IOException, ChannelOpenException {

        ByteArrayReader reader = new ByteArrayReader(data);
        initiator = reader.readBoolean();
        id = reader.readString();

        if (initiator) {
            System.out.println("Opening intiator channel");
            if (streamManager.containsChannel(id, true)) {
                throw new ChannelOpenException(ChannelOpenException.CHANNEL_REFUSED,
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

     *
     * @see com.maverick.multiplex.Channel#open(byte[])
     */
    public byte[] open(byte[] data) throws IOException, ChannelOpenException {

        ByteArrayReader reader = new ByteArrayReader(data);
        initiator = reader.readBoolean();
        id = reader.readString();
        // #ifdef DEBUG
        log.debug("Opening. Id is '" + id + "', initiator is '" + initiator + "'");
        // #endif

        if (initiator) {
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

    AgentTunnel agent = (AgentTunnel) connection;

    if (request.getRequestName().equals("setupAndLaunchApplication") && request.getRequestData()!=null) {

      try {
        ByteArrayReader reader = new ByteArrayReader(request.getRequestData());
        int id = (int)reader.readInt();
        Resource resource = ApplicationsPlugin.APPLICATION_SHORTCUT_RESOURCE_TYPE.getResourceById(id);
        if (resource == null) {
          throw new Exception("No resource with ID " + id);
        }
        Policy policy = LaunchSessionManager.getLaunchRequestPolicy(null, agent.getSession(), resource);
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

    }
   
    public boolean processRequest(Request request, MultiplexedConnection connection) {
     
      try {
        ByteArrayReader reader = new ByteArrayReader(request.getRequestData());
       
        int type = (int)reader.readInt();
        String name = reader.readString();
        ByteArrayWriter baw = new ByteArrayWriter();
       
        switch(type) {
          case PROFILE:
          {
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.