public synchronized Packet build ( ) { checkBuilt ( ) ; isBuilt = true ; try { dataOutputStream . close ( ) ; } catch ( final IOException e ) { logger . error ( "Unable to build packet: {} : {}" , e . getClass ( ) , e . getMessage ( ) ) ; } return new Packet ( packetType , packetID , byteArrayOutputStream . toByteArray ( ) ) ; }
Builds Packet with given data