ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/tomcat/util/http/parser/AcceptEncoding.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/tomcat/util/http/parser/AcceptEncoding.java
Status
scanned
Type
file
Name
AcceptEncoding.java
Extension
.java
Programming language
Java
Mime type
text/x-Algol68
File type
Algol 68 source, ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
2393 (2.3 KB)
MD5
97096cfc76aff30171e4bcb083a9a208
SHA1
5ac05eca13415936cb257dcc0c6c35a0ef1c98c5
SHA256
bd07e7222a2df1076b2229ae36b0d0f7e068f7fbd26944c11c2f74988748f305
SHA512

      
    
SHA1_git
645e76faecf1fdbc670b03e131bafc2c35aa49a0
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
AcceptEncoding.java | 2.3 KB |

/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.tomcat.util.http.parser; import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; import java.util.List; public class AcceptEncoding { private final String encoding; private final double quality; protected AcceptEncoding(String encoding, double quality) { this.encoding = encoding; this.quality = quality; } public String getEncoding() { return encoding; } public double getQuality() { return quality; } public static List<AcceptEncoding> parse(StringReader input) throws IOException { List<AcceptEncoding> result = new ArrayList<>(); do { String encoding = HttpParser.readToken(input); if (encoding == null) { // Invalid encoding, skip to the next one HttpParser.skipUntil(input, 0, ','); continue; } if (encoding.isEmpty()) { // No more data to read break; } // See if a quality has been provided double quality = 1; SkipResult lookForSemiColon = HttpParser.skipConstant(input, ";"); if (lookForSemiColon == SkipResult.FOUND) { quality = HttpParser.readWeight(input, ','); } if (quality > 0) { result.add(new AcceptEncoding(encoding, quality)); } } while (true); return result; } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
47.04
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9