Krenair

Untitled

Sep 25th, 2012
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1.         /**
  2.          * the first short in the stream indicates the number of bytes to read
  3.          */
  4.         public static byte[] readBytesFromStream(DataInputStream par0DataInputStream) throws IOException {
  5.                 short var1 = par0DataInputStream.readShort();
  6.  
  7.                 if (var1 < 0) {
  8.                         throw new IOException("Key was smaller than nothing!  Weird key!");
  9.                 }
  10.                 else {
  11.                         byte[] var2 = new byte[var1];
  12.                         par0DataInputStream.read(var2);
  13.                         return var2;
  14.                 }
  15.         }
Advertisement
Add Comment
Please, Sign In to add comment