Codota Logo
Message.asBytes
Code IndexAdd Codota to your IDE (free)

How to use
asBytes
method
in
com.wizzardo.http.websocket.Message

Best Java code snippets using com.wizzardo.http.websocket.Message.asBytes (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: com.wizzardo/simple-websocket-client

public String asString() {
  return new String(asBytes(), UTF_8);
}
origin: com.wizzardo/simple-websocket-client

public byte[] asBytes() {
  byte[] data = new byte[getBytesLength()];
  asBytes(data);
  return data;
}
origin: com.wizzardo/simple-websocket-client

public void onMessage(T listener, Message message) {
  try {
    byte[] bytes = message.asBytes();
    int[] holder = new int[1];
    int position = readInt(holder, bytes, 0, bytes.length);
    int nameLength = holder[0];
    String commandName;
    if (nameLength != -1) {
      commandName = new String(bytes, position, nameLength);
    } else {
      position = 0;
      nameLength = indexOf((byte) '{', bytes, position, bytes.length);
      commandName = new String(bytes, position, nameLength);
    }
    int offset = position + nameLength;
    Map.Entry<Class<? extends CommandPojo>, CommandHandler<? extends T, ? extends CommandPojo>> commandHandlerPair = handlers.get(commandName);
    if (commandHandlerPair == null)
      throw new IllegalArgumentException("Unknown command: " + commandName);
    CommandHandler<T, CommandPojo> handler = (CommandHandler<T, CommandPojo>) commandHandlerPair.getValue();
    Class<? extends CommandPojo> commandClass = commandHandlerPair.getKey();
    CommandPojo command = (CommandPojo) reader.read(commandClass, bytes, offset, bytes.length - offset);
    handler.handle(listener, command);
  } catch (Exception e) {
    onError(e);
  }
}
origin: wizzardo/http

  @Override
  public void onMessage(Message message) {
    md5Holder.set(MD5.create().update(message.asBytes()).asString());
  }
};
origin: wizzardo/http

  @Override
  public void onMessage(Message message) {
    md5Holder.set(MD5.create().update(message.asBytes()).asString());
  }
};
origin: wizzardo/http

  @Override
  public void onMessage(Message message) {
    md5Holder.set(MD5.create().update(message.asBytes()).asString());
  }
};
origin: wizzardo/http

  @Override
  public void onMessage(Message message) {
    md5Holder.set(MD5.create().update(message.asBytes()).asString());
  }
};
origin: wizzardo/http

  @Override
  public void onMessage(Message message) {
    md5Holder.set(MD5.create().update(message.asBytes()).asString());
  }
};
com.wizzardo.http.websocketMessageasBytes

Popular methods of Message

  • <init>
  • append
  • add
  • getFrames
  • isComplete
  • asString
  • clear
  • getBytesLength

Popular in Java

  • Creating JSON documents from java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • onRequestPermissionsResult (Fragment)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • PriorityQueue (java.util)
    An unbounded priority Queue based on a priority heap. The elements of the priority queue are ordered
  • Reference (javax.naming)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registery of org.quartz
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now