Package java.io

Examples of java.io.EOFException


  {
    int stringLength = dataIn.readInt();
    byte[] encodedString = IOUtil.readBytes(dataIn, stringLength);

    if (encodedString.length != stringLength) {
      throw new EOFException("Attempted to read " + stringLength + " bytes but no more than "
          + encodedString.length + " were available");
    }

    ByteBuffer byteBuf = ByteBuffer.wrap(encodedString);
    CharBuffer charBuf = charsetDecoder.decode(byteBuf);
View Full Code Here


    }
    int result = nextBytes[0];
    if (result == -1)
    {
      // End of stream reached without seeing the terminator
      throw new EOFException("Pre-mature end of <CRLF>.<CRLF> terminated data");
    }
    readWrappedStream();
    return result;
  }
View Full Code Here

    {
      line = this.reader.readLine();
      if (line == null)
      {
        if (builder.length() == 0)
          throw new EOFException("Server disconnected unexpectedly, no reply received");
        else
          throw new IOException("Malformed SMTP reply: " + builder);
      }

      if (log.isDebugEnabled())
View Full Code Here

    private String readTrimmedLine() throws IOException {
        String line = readLine();
        if (line != null)
            return line.trim();
        else
            throw new EOFException();
    }
View Full Code Here

    private int getInt() throws IOException {
        st.nextToken();
        if (st.ttype == StreamTokenizer.TT_WORD)
            return Integer.parseInt(st.sval);
        else if (st.ttype == StreamTokenizer.TT_EOF)
            throw new EOFException("End-of-File encountered during parsing");
        else
            throw new IOException("Unknown token found during parsing");
    }
View Full Code Here

    private long getLong() throws IOException {
        st.nextToken();
        if (st.ttype == StreamTokenizer.TT_WORD)
            return Long.parseLong(st.sval);
        else if (st.ttype == StreamTokenizer.TT_EOF)
            throw new EOFException("End-of-File encountered during parsing");
        else
            throw new IOException("Unknown token found during parsing");
    }
View Full Code Here

    private double getDouble() throws IOException {
        st.nextToken();
        if (st.ttype == StreamTokenizer.TT_WORD)
            return Double.parseDouble(st.sval);
        else if (st.ttype == StreamTokenizer.TT_EOF)
            throw new EOFException("End-of-File encountered during parsing");
        else
            throw new IOException("Unknown token found during parsing");
    }
View Full Code Here

    private float getFloat() throws IOException {
        st.nextToken();
        if (st.ttype == StreamTokenizer.TT_WORD)
            return Float.parseFloat(st.sval);
        else if (st.ttype == StreamTokenizer.TT_EOF)
            throw new EOFException("End-of-File encountered during parsing");
        else
            throw new IOException("Unknown token found during parsing");
    }
View Full Code Here

  {
    int stringLength = in.readInt();
    byte[] encodedString = IOUtil.readBytes(in, stringLength);

    if (encodedString.length != stringLength) {
      throw new EOFException("Attempted to read " + stringLength + " bytes but no more than "
          + encodedString.length + " were available");
    }

    ByteBuffer byteBuf = ByteBuffer.wrap(encodedString);
    CharBuffer charBuf = charsetDecoder.decode(byteBuf);
View Full Code Here

     */
    private void readFully(byte[] b, int off, int len) throws IOException {
  while (len > 0) {
      int n = in.read(b, off, len);
      if (n == -1) {
    throw new EOFException();
      }
      off += n;
      len -= n;
  }
    }
View Full Code Here

TOP

Related Classes of java.io.EOFException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.