Android Open Source - VisEQ Packet Parser






From Project

Back to project page VisEQ.

License

The source code is released under:

Copyright (c) 2012, Spotify AB All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:...

If you think the Android project VisEQ listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.lsu.vizeq;
// w w  w . j  av a  2 s  .c om
import java.net.DatagramPacket;

import android.util.Log;

public class PacketParser {
  
  public static String getHeader(DatagramPacket packet)
  {
    String header = "";
    
    String data = new String(packet.getData());
    int nlindx = data.indexOf('\n');
    if(nlindx < 0)
      nlindx = data.indexOf(0);
    header = data.substring(0,nlindx);
    
    return header;
  }
  
  public static String[] getArgs(DatagramPacket packet)
  {
    String[] args;
    String data = new String(packet.getData());
    int numArgs = 0;
//    Log.d("packetparser", data);
    
    for(int i=0; i<data.length(); i++)
    {
      if(data.charAt(i)=='\n')
        numArgs++;
    }
    args = new String[numArgs];
    
    int nlindx = data.indexOf('\n');
    boolean end = false;
    
    int count = 0;
    
    while(!end)
    {
      String arg;
      
      data = data.substring(nlindx+1);
      nlindx = data.indexOf('\n');
      if(nlindx < 0)
      {
        nlindx = data.indexOf(0);
        end = true;
      }
      arg = data.substring(0, nlindx);
      args[count++] = arg;
    }
    return args;
  }

}




Java Source Code List

com.lsu.vizeq.AboutActivity.java
com.lsu.vizeq.Artist.java
com.lsu.vizeq.BackableActivity.java
com.lsu.vizeq.HostActivity.java
com.lsu.vizeq.HostMenuActivity.java
com.lsu.vizeq.HostProfileActivity.java
com.lsu.vizeq.HostSoundVisualizationActivity.java
com.lsu.vizeq.Installation.java
com.lsu.vizeq.LibSpotifyWrapper.java
com.lsu.vizeq.LoginActivity.java
com.lsu.vizeq.MyApplication.java
com.lsu.vizeq.MyCanvas.java
com.lsu.vizeq.PVCircle.java
com.lsu.vizeq.PacketParser.java
com.lsu.vizeq.PlayerActivity.java
com.lsu.vizeq.PreferenceCircle.java
com.lsu.vizeq.PreferenceVisualizationActivity.java
com.lsu.vizeq.PreferenceVisualizer.java
com.lsu.vizeq.ProfileActivity.java
com.lsu.vizeq.RemoteControlReceiver.java
com.lsu.vizeq.RequestDetailsActivity.java
com.lsu.vizeq.RoleActivity.java
com.lsu.vizeq.SearchActivity.java
com.lsu.vizeq.SearchPartyActivity.java
com.lsu.vizeq.ServiceBinder.java
com.lsu.vizeq.SettingsActivity.java
com.lsu.vizeq.SoundVisualizationActivity.java
com.lsu.vizeq.SpotifyService.java
com.lsu.vizeq.TrackRow.java
com.lsu.vizeq.Track.java
com.lsu.vizeq.VisualizerView.java
com.lsu.vizeq.VizEQ.java
com.lsu.vizeq.WebService.java
com.lsu.vizeq.util.SystemPropertiesProxy.java
com.lsu.vizeq.util.SystemUiHiderBase.java
com.lsu.vizeq.util.SystemUiHiderHoneycomb.java
com.lsu.vizeq.util.SystemUiHider.java
com.lsu.vizeq.util.TunnelPlayerWorkaround.java