org.apache.http.ParseException.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(13.1k)|赞(0)|评价(0)|浏览(175)

本文整理了Java中org.apache.http.ParseException.<init>()方法的一些代码示例,展示了ParseException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ParseException.<init>()方法的具体详情如下:
包路径:org.apache.http.ParseException
类名称:ParseException
方法名:<init>

ParseException.<init>介绍

[英]Creates a ParseException without details.
[中]创建没有详细信息的ParseException。

代码示例

代码示例来源:origin: robovm/robovm

from++;
} else if (isTokenChar(ch)) {
  throw new ParseException
    ("Tokens without separator (pos " + from +
     "): " + this.currentHeader);
} else {
  throw new ParseException
    ("Invalid character after token (pos " + from +
     "): " + this.currentHeader);

代码示例来源:origin: robovm/robovm

/**
 * Creates a new header from a buffer.
 * The name of the header will be parsed immediately,
 * the value only if it is accessed.
 *
 * @param buffer    the buffer containing the header to represent
 *
 * @throws ParseException   in case of a parse error
 */
public BufferedHeader(final CharArrayBuffer buffer)
  throws ParseException {
  super();
  if (buffer == null) {
    throw new IllegalArgumentException
      ("Char array buffer may not be null");
  }
  int colon = buffer.indexOf(':');
  if (colon == -1) {
    throw new ParseException
      ("Invalid header: " + buffer.toString());
  }
  String s = buffer.substringTrimmed(0, colon);
  if (s.length() == 0) {
    throw new ParseException
      ("Invalid header: " + buffer.toString());
  }
  this.buffer = buffer;
  this.name = s;
  this.valuePos = colon + 1;
}

代码示例来源:origin: robovm/robovm

throw new ParseException
  ("Invalid character before token (pos " + from +
   "): " + this.currentHeader);

代码示例来源:origin: robovm/robovm

throw new ParseException
    ("Not a valid protocol version: " +
     buffer.substring(indexFrom, indexTo));
  throw new ParseException
    ("Not a valid protocol version: " +
     buffer.substring(indexFrom, indexTo));
  throw new ParseException
    ("Invalid protocol version number: " + 
     buffer.substring(indexFrom, indexTo));
  major = Integer.parseInt(buffer.substringTrimmed(i, period)); 
} catch (NumberFormatException e) {
  throw new ParseException
    ("Invalid protocol major version number: " + 
     buffer.substring(indexFrom, indexTo));
  minor = Integer.parseInt(buffer.substringTrimmed(i, blank)); 
} catch (NumberFormatException e) {
  throw new ParseException(
    "Invalid protocol minor version number: " + 
    buffer.substring(indexFrom, indexTo));

代码示例来源:origin: robovm/robovm

Integer.parseInt(buffer.substringTrimmed(i, blank));
} catch (NumberFormatException e) {
  throw new ParseException(
    "Unable to parse status code from status line: " 
    + buffer.substring(indexFrom, indexTo));
throw new ParseException("Invalid status line: " + 
             buffer.substring(indexFrom, indexTo));

代码示例来源:origin: robovm/robovm

throw new ParseException("Invalid request line: " + 
      buffer.substring(indexFrom, indexTo));
  throw new ParseException("Invalid request line: " + 
      buffer.substring(indexFrom, indexTo));
  throw new ParseException("Invalid request line: " + 
      buffer.substring(indexFrom, indexTo));
throw new ParseException("Invalid request line: " + 
             buffer.substring(indexFrom, indexTo));

代码示例来源:origin: sahan/RoboZombie

/**
 * Parses textual representation of <code>Content-Type</code> value.
 *
 * @param s text
 * @return content type
 * @throws ParseException if the given text does not represent a valid
 * <code>Content-Type</code> value.
 */
public static ContentType parse(
    final String s) throws ParseException, UnsupportedCharsetException {
  if (s == null) {
    throw new IllegalArgumentException("Content type may not be null");
  }
  HeaderElement[] elements = BasicHeaderValueParser.parseElements(s, null);
  if (elements.length > 0) {
    return create(elements[0]);
  } else {
    throw new ParseException("Invalid content type: " + s);
  }
}

代码示例来源:origin: GistLabs/mechanize

/**
 * Parses textual representation of <code>Content-Type</code> value.
 *
 * @param s text
 * @return content type
 * @throws ParseException if the given text does not represent a valid
 * <code>Content-Type</code> value.
 */
public static ContentType parse(
    final String s) throws ParseException, UnsupportedCharsetException {
  if (s == null) {
    throw new IllegalArgumentException("Content type may not be null");
  }
  HeaderElement[] elements = BasicHeaderValueParser.parseElements(s, null);
  if (elements.length > 0) {
    return create(elements[0]);
  } else {
    throw new ParseException("Invalid content type: " + s);
  }
}

代码示例来源:origin: MobiVM/robovm

/**
 * Creates a new header from a buffer.
 * The name of the header will be parsed immediately,
 * the value only if it is accessed.
 *
 * @param buffer    the buffer containing the header to represent
 *
 * @throws ParseException   in case of a parse error
 */
public BufferedHeader(final CharArrayBuffer buffer)
  throws ParseException {
  super();
  if (buffer == null) {
    throw new IllegalArgumentException
      ("Char array buffer may not be null");
  }
  int colon = buffer.indexOf(':');
  if (colon == -1) {
    throw new ParseException
      ("Invalid header: " + buffer.toString());
  }
  String s = buffer.substringTrimmed(0, colon);
  if (s.length() == 0) {
    throw new ParseException
      ("Invalid header: " + buffer.toString());
  }
  this.buffer = buffer;
  this.name = s;
  this.valuePos = colon + 1;
}

代码示例来源:origin: ibinti/bugvm

/**
 * Creates a new header from a buffer.
 * The name of the header will be parsed immediately,
 * the value only if it is accessed.
 *
 * @param buffer    the buffer containing the header to represent
 *
 * @throws ParseException   in case of a parse error
 */
public BufferedHeader(final CharArrayBuffer buffer)
  throws ParseException {
  super();
  Args.notNull(buffer, "Char array buffer");
  final int colon = buffer.indexOf(':');
  if (colon == -1) {
    throw new ParseException
      ("Invalid header: " + buffer.toString());
  }
  final String s = buffer.substringTrimmed(0, colon);
  if (s.length() == 0) {
    throw new ParseException
      ("Invalid header: " + buffer.toString());
  }
  this.buffer = buffer;
  this.name = s;
  this.valuePos = colon + 1;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpcore

/**
 * Creates a new header from a buffer.
 * The name of the header will be parsed immediately,
 * the value only if it is accessed.
 *
 * @param buffer    the buffer containing the header to represent
 *
 * @throws ParseException   in case of a parse error
 */
public BufferedHeader(final CharArrayBuffer buffer)
  throws ParseException {
  super();
  Args.notNull(buffer, "Char array buffer");
  final int colon = buffer.indexOf(':');
  if (colon == -1) {
    throw new ParseException
      ("Invalid header: " + buffer.toString());
  }
  final String s = buffer.substringTrimmed(0, colon);
  if (s.length() == 0) {
    throw new ParseException
      ("Invalid header: " + buffer.toString());
  }
  this.buffer = buffer;
  this.name = s;
  this.valuePos = colon + 1;
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * Creates a new header from a buffer.
 * The name of the header will be parsed immediately,
 * the value only if it is accessed.
 *
 * @param buffer    the buffer containing the header to represent
 *
 * @throws ParseException   in case of a parse error
 */
public BufferedHeader(final CharArrayBuffer buffer)
  throws ParseException {
  super();
  Args.notNull(buffer, "Char array buffer");
  final int colon = buffer.indexOf(':');
  if (colon == -1) {
    throw new ParseException
      ("Invalid header: " + buffer.toString());
  }
  final String s = buffer.substringTrimmed(0, colon);
  if (s.length() == 0) {
    throw new ParseException
      ("Invalid header: " + buffer.toString());
  }
  this.buffer = buffer;
  this.name = s;
  this.valuePos = colon + 1;
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Creates a new header from a buffer.
 * The name of the header will be parsed immediately,
 * the value only if it is accessed.
 *
 * @param buffer    the buffer containing the header to represent
 *
 * @throws ParseException   in case of a parse error
 */
public BufferedHeader(final CharArrayBuffer buffer)
  throws ParseException {
  super();
  Args.notNull(buffer, "Char array buffer");
  final int colon = buffer.indexOf(':');
  if (colon == -1) {
    throw new ParseException
      ("Invalid header: " + buffer.toString());
  }
  final String s = buffer.substringTrimmed(0, colon);
  if (s.length() == 0) {
    throw new ParseException
      ("Invalid header: " + buffer.toString());
  }
  this.buffer = buffer;
  this.name = s;
  this.valuePos = colon + 1;
}

代码示例来源:origin: Nextdoor/bender

/**
 * Creates a new header from a buffer.
 * The name of the header will be parsed immediately,
 * the value only if it is accessed.
 *
 * @param buffer    the buffer containing the header to represent
 *
 * @throws ParseException   in case of a parse error
 */
public BufferedHeader(final CharArrayBuffer buffer)
  throws ParseException {
  super();
  Args.notNull(buffer, "Char array buffer");
  final int colon = buffer.indexOf(':');
  if (colon == -1) {
    throw new ParseException
      ("Invalid header: " + buffer.toString());
  }
  final String s = buffer.substringTrimmed(0, colon);
  if (s.length() == 0) {
    throw new ParseException
      ("Invalid header: " + buffer.toString());
  }
  this.buffer = buffer;
  this.name = s;
  this.valuePos = colon + 1;
}

代码示例来源:origin: ibinti/bugvm

/**
 * Parses textual representation of {@code Content-Type} value.
 *
 * @param s text
 * @return content type
 * @throws ParseException if the given text does not represent a valid
 * {@code Content-Type} value.
 * @throws UnsupportedCharsetException Thrown when the named charset is not available in
 * this instance of the Java virtual machine
 */
public static ContentType parse(
    final String s) throws ParseException, UnsupportedCharsetException {
  Args.notNull(s, "Content type");
  final CharArrayBuffer buf = new CharArrayBuffer(s.length());
  buf.append(s);
  final ParserCursor cursor = new ParserCursor(0, s.length());
  final HeaderElement[] elements = BasicHeaderValueParser.INSTANCE.parseElements(buf, cursor);
  if (elements.length > 0) {
    return create(elements[0], true);
  } else {
    throw new ParseException("Invalid content type: " + s);
  }
}

代码示例来源:origin: org.apache.httpcomponents/httpclient-android

/**
 * Parses textual representation of <code>Content-Type</code> value.
 *
 * @param s text
 * @return content type
 * @throws ParseException if the given text does not represent a valid
 * <code>Content-Type</code> value.
 * @throws UnsupportedCharsetException Thrown when the named charset is not available in
 * this instance of the Java virtual machine
 */
public static ContentType parse(
    final String s) throws ParseException, UnsupportedCharsetException {
  Args.notNull(s, "Content type");
  final CharArrayBuffer buf = new CharArrayBuffer(s.length());
  buf.append(s);
  final ParserCursor cursor = new ParserCursor(0, s.length());
  final HeaderElement[] elements = BasicHeaderValueParserHC4.INSTANCE.parseElements(buf, cursor);
  if (elements.length > 0) {
    return create(elements[0]);
  } else {
    throw new ParseException("Invalid content type: " + s);
  }
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpcore

/**
 * Parses textual representation of <code>Content-Type</code> value.
 *
 * @param s text
 * @return content type
 * @throws ParseException if the given text does not represent a valid
 * <code>Content-Type</code> value.
 * @throws UnsupportedCharsetException Thrown when the named charset is not available in
 * this instance of the Java virtual machine
 */
public static ContentType parse(
    final String s) throws ParseException, UnsupportedCharsetException {
  Args.notNull(s, "Content type");
  final CharArrayBuffer buf = new CharArrayBuffer(s.length());
  buf.append(s);
  final ParserCursor cursor = new ParserCursor(0, s.length());
  final HeaderElement[] elements = BasicHeaderValueParser.INSTANCE.parseElements(buf, cursor);
  if (elements.length > 0) {
    return create(elements[0]);
  } else {
    throw new ParseException("Invalid content type: " + s);
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Parses textual representation of {@code Content-Type} value.
 *
 * @param s text
 * @return content type
 * @throws ParseException if the given text does not represent a valid
 * {@code Content-Type} value.
 * @throws UnsupportedCharsetException Thrown when the named charset is not available in
 * this instance of the Java virtual machine
 */
public static ContentType parse(
    final String s) throws ParseException, UnsupportedCharsetException {
  Args.notNull(s, "Content type");
  final CharArrayBuffer buf = new CharArrayBuffer(s.length());
  buf.append(s);
  final ParserCursor cursor = new ParserCursor(0, s.length());
  final HeaderElement[] elements = BasicHeaderValueParser.INSTANCE.parseElements(buf, cursor);
  if (elements.length > 0) {
    return create(elements[0], true);
  } else {
    throw new ParseException("Invalid content type: " + s);
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * Parses textual representation of {@code Content-Type} value.
 *
 * @param s text
 * @return content type
 * @throws ParseException if the given text does not represent a valid
 * {@code Content-Type} value.
 * @throws UnsupportedCharsetException Thrown when the named charset is not available in
 * this instance of the Java virtual machine
 */
public static ContentType parse(
    final String s) throws ParseException, UnsupportedCharsetException {
  Args.notNull(s, "Content type");
  final CharArrayBuffer buf = new CharArrayBuffer(s.length());
  buf.append(s);
  final ParserCursor cursor = new ParserCursor(0, s.length());
  final HeaderElement[] elements = BasicHeaderValueParser.INSTANCE.parseElements(buf, cursor);
  if (elements.length > 0) {
    return create(elements[0], true);
  } else {
    throw new ParseException("Invalid content type: " + s);
  }
}

代码示例来源:origin: Nextdoor/bender

/**
 * Parses textual representation of {@code Content-Type} value.
 *
 * @param s text
 * @return content type
 * @throws ParseException if the given text does not represent a valid
 * {@code Content-Type} value.
 * @throws UnsupportedCharsetException Thrown when the named charset is not available in
 * this instance of the Java virtual machine
 */
public static ContentType parse(
    final String s) throws ParseException, UnsupportedCharsetException {
  Args.notNull(s, "Content type");
  final CharArrayBuffer buf = new CharArrayBuffer(s.length());
  buf.append(s);
  final ParserCursor cursor = new ParserCursor(0, s.length());
  final HeaderElement[] elements = BasicHeaderValueParser.INSTANCE.parseElements(buf, cursor);
  if (elements.length > 0) {
    return create(elements[0], true);
  } else {
    throw new ParseException("Invalid content type: " + s);
  }
}

相关文章