Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Answer(InputStream input)
- {
- byte[] bytes = new byte[getDataLength()];
- try
- {
- if (input.read(bytes, 0, getDataLength()) != getDataLength()) {
- throw new InterruptedException();
- }
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- catch (InterruptedException e)
- {
- e.printStackTrace();
- }
- ByteBuffer byteBuffer = ByteBuffer.allocate(getDataLength());
- byteBuffer.put(bytes);
- byteBuffer.rewind();
- this.myShootResult = ShootResult.fromInt(byteBuffer.getInt());
- this.enemyShootResult = ShootResult.fromInt(byteBuffer.getInt());
- this.enemyShootX = byteBuffer.getInt();
- this.enemyShootY = byteBuffer.getInt();
- this.moveSuccessCount = byteBuffer.getInt();
- this.newShipCount = byteBuffer.getInt();
- this.fieldHeight = byteBuffer.getInt();
- this.fieldWidth = byteBuffer.getInt();
- }
Advertisement
Add Comment
Please, Sign In to add comment