title: Java: Difference with dis.read() and dis.readUTF() in DataInputStream
body: <p>Simple Question.</p>
  
  <p>What is Difference with <code>dis.read()</code> and <code>dis.readUTF()</code>?</p>
  
  <p>For example, <code>dis.read()</code> only read to byte array, and <code>dis.readUTF()</code> access <code>String</code> type.</p>
  
  <p>Is it correct?</p>
  
  <p>If Server has implements <code>dis.readUTF()</code>, it can not read byte stream?</p>
  
  <pre><code>@Override
  public void run() {
      // TODO Auto-generated method stub
      while(mEnabled)
      {
          if (!mFileReceive) {
              try {
                  // read
                  String tmpStr = dis.readUTF();
                  // here come `dis.readUTF()` &lt;- it is can not read byte array?
  
                  mStringBuffer += tmpStr;
  
                  if (tmpStr.length() &gt;= 4096)
                      continue;
                  System.out.println("Print : " + mStringBuffer);
  
                  parse = new ParseJSON(null, mStringBuffer.toString());
                  // Ack Message
                  if (mAckEnabled) {
                      mFileName = "{opcode:0x06,ACK:C" + parse.getParsedData().get("ACK").substring(1) + "}";
                      dos.writeUTF(mFileName);
                      dos.flush();
                      System.out.println("Ack Message Send : " + mFileName);
                      mFileName = null;
                  }
                  if (parse.getParsedData().get("opcode").equals("155")) {
                      mFileReceive = true;
                  }
                  parse.clear();
                  parse = null;
  
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  System.out.println("ServerThread disconnect");
                  break;
              }
  </code></pre>