code: public static byte[] readToNull(InputStream is, int maxSize)
  		throws IOException {
  
  		byte[] bytes = new byte[maxSize];
  		int i = 0;
  		while(i < maxSize) {
  			int b = is.read();
  			if(b == -1) {
  				throw new EOFException("NO NULL");
  			}
  			bytes[i] = (byte) (b & 0xff);
  			i++;
  			if(b == 0) {
  				return copy(bytes,0,i);
  			}
  		}
  		// BUGBUG: This isn't the right exception!!!
  		// TODO: just skip any more bytes until NULL or EOF
  		//       throw an EOF if we find it... produce warning, too
  		throw new IOException("Buffer too small");
  	}
docs: Read, buffer, and return bytes from is until a null byte is encountered
  @param is InputStream to read from
  @param maxSize maximum number of bytes to search for the null
  @return array of bytes read, INCLUDING TRAILING NULL
  @throws IOException if the underlying stream throws on, OR if the
  specified maximum buffer size is reached before a null byte is found
  @throws ShortByteReadException if EOF is encountered before a null byte