< prev index next >
src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HeaderParser.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 56,85 ****
this.raw = raw;
tab = new String[asize][2];
parse();
}
! private HeaderParser () { }
! /**
! * Creates a new HeaderParser from this, whose keys (and corresponding
! * values) range from "start" to "end-1"
! */
! public HeaderParser subsequence(int start, int end) {
! if (start == 0 && end == nkeys) {
! return this;
! }
! if (start < 0 || start >= end || end > nkeys) {
! throw new IllegalArgumentException("invalid start or end");
! }
! HeaderParser n = new HeaderParser();
! n.tab = new String [asize][2];
! n.asize = asize;
! System.arraycopy (tab, start, n.tab, 0, (end-start));
! n.nkeys= (end-start);
! return n;
! }
private void parse() {
if (raw != null) {
raw = raw.trim();
--- 56,85 ----
this.raw = raw;
tab = new String[asize][2];
parse();
}
! // private HeaderParser () { }
! // /**
! // * Creates a new HeaderParser from this, whose keys (and corresponding
! // * values) range from "start" to "end-1"
! // */
! // public HeaderParser subsequence(int start, int end) {
! // if (start == 0 && end == nkeys) {
! // return this;
! // }
! // if (start < 0 || start >= end || end > nkeys) {
! // throw new IllegalArgumentException("invalid start or end");
! // }
! // HeaderParser n = new HeaderParser();
! // n.tab = new String [asize][2];
! // n.asize = asize;
! // System.arraycopy (tab, start, n.tab, 0, (end-start));
! // n.nkeys= (end-start);
! // return n;
! // }
private void parse() {
if (raw != null) {
raw = raw.trim();
*** 214,226 ****
public Iterator<String> keys () {
return new ParserIterator (false);
}
! public Iterator<String> values () {
! return new ParserIterator (true);
! }
@Override
public String toString () {
Iterator<String> k = keys();
StringBuilder sb = new StringBuilder();
--- 214,226 ----
public Iterator<String> keys () {
return new ParserIterator (false);
}
! // public Iterator<String> values () {
! // return new ParserIterator (true);
! // }
@Override
public String toString () {
Iterator<String> k = keys();
StringBuilder sb = new StringBuilder();
*** 240,252 ****
}
sb.append (" }");
return sb.toString();
}
! public int findInt(String k, int Default) {
! try {
! return Integer.parseInt(findValue(k, String.valueOf(Default)));
! } catch (Throwable t) {
! return Default;
! }
! }
}
--- 240,252 ----
}
sb.append (" }");
return sb.toString();
}
! // public int findInt(String k, int Default) {
! // try {
! // return Integer.parseInt(findValue(k, String.valueOf(Default)));
! // } catch (Throwable t) {
! // return Default;
! // }
! // }
}
< prev index next >