1 package org.sapia.ubik.net.mplex; 2 3 import java.io.ByteArrayInputStream ; 4 import java.io.DataInputStream ; 5 import java.io.IOException ; 6 7 8 20 public class ObjectStreamSelector implements StreamSelector { 21 24 final static short STREAM_MAGIC = (short) 0xaced; 25 26 29 final static short STREAM_VERSION = 5; 30 31 34 public ObjectStreamSelector() { 35 } 36 37 43 public boolean selectStream(byte[] header) { 44 DataInputStream data = new DataInputStream (new ByteArrayInputStream (header)); 45 46 try { 47 if ((data.readShort() != STREAM_MAGIC) || 48 (data.readShort() != STREAM_VERSION)) { 49 return false; 50 } else { 51 return true; 52 } 53 } catch (IOException ioe) { 54 ioe.printStackTrace(); 55 56 return false; 57 } 58 } 59 } 60 | Popular Tags |