Examples of ByteArrayReader


Examples of com.drew.lang.ByteArrayReader

            byte[] jpegSegment = segmentReader.getSegment((byte)(JpegSegmentReader.SEGMENT_SOF0 + i));
            if (jpegSegment == null)
                continue;
            JpegDirectory directory = metadata.getOrCreateDirectory(JpegDirectory.class);
            directory.setInt(JpegDirectory.TAG_JPEG_COMPRESSION_TYPE, i);
            new JpegReader().extract(new ByteArrayReader(jpegSegment), metadata);
            break;
        }

        // There should never be more than one COM segment.
        byte[] comSegment = segmentReader.getSegment(JpegSegmentReader.SEGMENT_COM);
        if (comSegment != null)
            new JpegCommentReader().extract(new ByteArrayReader(comSegment), metadata);

        // Loop through all APP0 segments, looking for a JFIF segment.
        for (byte[] app0Segment : segmentReader.getSegments(JpegSegmentReader.SEGMENT_APP0)) {
            if (app0Segment.length > 3 && new String(app0Segment, 0, 4).equals("JFIF"))
                new JfifReader().extract(new ByteArrayReader(app0Segment), metadata);
        }

        // Loop through all APP1 segments, checking the leading bytes to identify the format of each.
        for (byte[] app1Segment : segmentReader.getSegments(JpegSegmentReader.SEGMENT_APP1)) {
            if (app1Segment.length > 3 && "EXIF".equalsIgnoreCase(new String(app1Segment, 0, 4)))
                new ExifReader().extract(new ByteArrayReader(app1Segment), metadata);

            if (app1Segment.length > 27 && "http://ns.adobe.com/xap/1.0/".equalsIgnoreCase(new String(app1Segment, 0, 28)))
                new XmpReader().extract(new ByteArrayReader(app1Segment), metadata);
        }

        // Loop through all APP2 segments, looking for something we can process.
        for (byte[] app2Segment : segmentReader.getSegments(JpegSegmentReader.SEGMENT_APP2)) {
            if (app2Segment.length > 10 && new String(app2Segment, 0, 11).equalsIgnoreCase("ICC_PROFILE")) {
                byte[] icc = new byte[app2Segment.length-14];
                System.arraycopy(app2Segment, 14, icc, 0, app2Segment.length-14);
                new IccReader().extract(new ByteArrayReader(icc), metadata);
            }
        }

        // Loop through all APPD segments, checking the leading bytes to identify the format of each.
        for (byte[] appdSegment : segmentReader.getSegments(JpegSegmentReader.SEGMENT_APPD)) {
            if (appdSegment.length > 12 && "Photoshop 3.0".compareTo(new String(appdSegment, 0, 13))==0) {
                new PhotoshopReader().extract(new ByteArrayReader(appdSegment), metadata);
            } else {
                // TODO might be able to check for a leading 0x1c02 for IPTC data...
                new IptcReader().extract(new ByteArrayReader(appdSegment), metadata);
            }
        }

        // Loop through all APPE segments, checking the leading bytes to identify the format of each.
        for (byte[] appeSegment : segmentReader.getSegments(JpegSegmentReader.SEGMENT_APPE)) {
            if (appeSegment.length == 12 && "Adobe".compareTo(new String(appeSegment, 0, 5))==0) {
                new AdobeJpegReader().extract(new ByteArrayReader(appeSegment), metadata);
            }
        }

        return metadata;
    }
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

    try {
      ByteArrayWriter baw = new ByteArrayWriter();
      baw.writeInt(resourceId);
      Request request = new Request(SETUP_AND_LAUNCH_WEB_FORWARD, baw.toByteArray());
      if (agent.getConnection().sendRequest(request, true) && request.getRequestData()!=null) {
        ByteArrayReader bar = new ByteArrayReader(request.getRequestData());
        String uri = bar.readString();
        agent.getGUI().openBrowser(uri);
        // #ifdef DEBUG
        log.debug("Application launch setup");
        // #endif
//        processLaunchRequest(request);
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

    try {
      ByteArrayWriter baw = new ByteArrayWriter();
      baw.writeInt(resourceId);
      Request request = new Request(SETUP_AND_LAUNCH_NETWORK_PLACE, baw.toByteArray());
      if (agent.getConnection().sendRequest(request, true) && request.getRequestData()!=null) {
        ByteArrayReader bar = new ByteArrayReader(request.getRequestData());
        String uri = bar.readString();
        agent.getGUI().openBrowser(uri);
        // #ifdef DEBUG
        log.debug("Network place setup");
        // #endif
//        processLaunchRequest(request);
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

    msg.writeString(launchId);
    return msg.toByteArray();
  }

  public byte[] open(byte[] data) throws IOException {
    ByteArrayReader msg = new ByteArrayReader(data);
    this.hostname = msg.readString();
    this.port = (int) msg.readInt();
    this.launchId = msg.readString();
        this.socket = MultiplexedSocketFactory.getDefault().createSocket(hostname, port);
    return null;
  }
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

      }
    }
  }

  public byte[] open(byte[] data) throws IOException, ChannelOpenException {
    ByteArrayReader reply = new ByteArrayReader(data);

    String launchId = reply.readString();
    int id = (int) reply.readInt();
    String name = reply.readString();
    int type = (int) reply.readInt();
    String transport = reply.readString();
    String sourceInterface = reply.readString();
    int sourcePort = (int) reply.readInt();
    int destinationPort = (int) reply.readInt();
    String destinationHost = reply.readString();
   

    if(agent.getConfiguration().isRemoteTunnelsRequireConfirmation()) {
      if(!agent.getGUI().confirm(AgentClientGUI.WARNING, Messages.getString("RemoteForwardingChannelListener.confirmRemoteTunnel")//$NON-NLS-1$$
        Messages.getString("RemoteForwardingChannelListener.cancelRemoteTunnel"),    //$NON-NLS-1$$
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

      ByteArrayWriter baw = new ByteArrayWriter();
      baw.writeInt(resourceType);
      Request request = new Request("getResources", baw.toByteArray());
      if (agent.getConnection().sendRequest(request, true)) {
        if(request.getRequestData()!=null) {
          ByteArrayReader reader = new ByteArrayReader(request.getRequestData());
          int count = (int) reader.readInt();
          if (count > 0) {
                      if(agent.getGUI().isMenuExists(menu))
                          agent.getGUI().clearMenu(menu);
                      else
                          agent.getGUI().addMenu(menu);
            for (int i = 0; i < count; i++) {
              int resourceId = (int) reader.readInt();
              agent.getGUI().addMenuItem(menu, new ResourceLaunchAction(resourceId, reader.readString()));
            }
          }
          else {
                        if(agent.getGUI().isMenuExists(menu))
                            agent.getGUI().removeMenu(menu);             
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

//      if (portItem.getActiveTunnelCount() == 0) {
//        portMonitor.removeItemAt(idx);
//      } else {
     
      try {
        ByteArrayReader bar = new ByteArrayReader(request.getRequestData());
        int resourceId = (int)bar.readInt();
        String resourceName = bar.readString();
        String launchId = bar.readString();
        String listeningInterface = bar.readString();
        int listeningPort = (int) bar.readInt();
        String destinationHost = bar.readString();
        int destinationPort = (int) bar.readInt();
       
        /**
         * This code should be called after this method but from the agent
         * class.
         */
 
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

  void stopLocalTunnel(Request request) {

    if (request.getRequestData() == null)
      return;
    try {
      ByteArrayReader msg = new ByteArrayReader(request.getRequestData());
      stopLocalTunnel(new Integer((int) msg.readInt()), false);
      request.setRequestData(null);

    } catch (IOException ex) {
      // #ifdef DEBUG
      log.error("Failed to read tunnel id from request", ex);
View Full Code Here

Examples of com.maverick.util.ByteArrayReader

      /**
       * Start a local forwarding. This creates a listening socket on the
       * client and will forward sockets opened through the multiplexed
       * connection to the Adito server.
       */
      ByteArrayReader reply = new ByteArrayReader(configurationData);
      String launchId = reply.readString();

      int id = (int) reply.readInt();
      String name = reply.readString();
      int type = (int) reply.readInt();
      String transport = reply.readString();
      String sourceInterface = reply.readString();
      int sourcePort = (int) reply.readInt();
      int destinationPort = (int) reply.readInt();
      String destinationHost = reply.readString();

      // #ifdef DEBUG
      log.info("Received permanent tunnel named " + name + " for " + destinationHost + ":" + destinationPort);
      // #endif

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_WEB_FORWARD) && request.getRequestData()!=null) {
      try {
        ByteArrayReader reader = new ByteArrayReader(request.getRequestData());
        int id = (int)reader.readInt();
        WebForward resource = (WebForward)WebForwardPlugin.WEBFORWARD_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
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.