1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Oct 2017
4 */
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21 package com.sun.org.apache.bcel.internal.classfile;
22
23 import java.io.ByteArrayInputStream;
27 import java.io.FilterReader;
28 import java.io.FilterWriter;
29 import java.io.IOException;
30 import java.io.PrintStream;
31 import java.io.PrintWriter;
32 import java.io.Reader;
33 import java.io.Writer;
34 import java.util.ArrayList;
35 import java.util.List;
36 import java.util.Locale;
37 import java.util.zip.GZIPInputStream;
38 import java.util.zip.GZIPOutputStream;
39
40 import com.sun.org.apache.bcel.internal.Const;
41 import com.sun.org.apache.bcel.internal.util.ByteSequence;
42
43 /**
44 * Utility functions that do not really belong to any class in particular.
45 *
46 * @version $Id: Utility.java 1751107 2016-07-03 02:41:18Z dbrosius $
47 */
48 // @since 6.0 methods are no longer final
49 public abstract class Utility {
50
51 private static int unwrap(final ThreadLocal<Integer> tl) {
52 return tl.get().intValue();
53 }
54
55 private static void wrap(final ThreadLocal<Integer> tl, final int value) {
56 tl.set(Integer.valueOf(value));
57 }
58
59 private static ThreadLocal<Integer> consumed_chars = new ThreadLocal<Integer>() {
60
61 @Override
62 protected Integer initialValue() {
63 return Integer.valueOf(0);
64 }
65 };/* How many chars have been consumed
66 * during parsing in signatureToString().
|
1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 package com.sun.org.apache.bcel.internal.classfile;
21
22 import java.io.ByteArrayInputStream;
26 import java.io.FilterReader;
27 import java.io.FilterWriter;
28 import java.io.IOException;
29 import java.io.PrintStream;
30 import java.io.PrintWriter;
31 import java.io.Reader;
32 import java.io.Writer;
33 import java.util.ArrayList;
34 import java.util.List;
35 import java.util.Locale;
36 import java.util.zip.GZIPInputStream;
37 import java.util.zip.GZIPOutputStream;
38
39 import com.sun.org.apache.bcel.internal.Const;
40 import com.sun.org.apache.bcel.internal.util.ByteSequence;
41
42 /**
43 * Utility functions that do not really belong to any class in particular.
44 *
45 * @version $Id: Utility.java 1751107 2016-07-03 02:41:18Z dbrosius $
46 * @LastModified: Oct 2017
47 */
48 // @since 6.0 methods are no longer final
49 public abstract class Utility {
50
51 private static int unwrap(final ThreadLocal<Integer> tl) {
52 return tl.get().intValue();
53 }
54
55 private static void wrap(final ThreadLocal<Integer> tl, final int value) {
56 tl.set(Integer.valueOf(value));
57 }
58
59 private static ThreadLocal<Integer> consumed_chars = new ThreadLocal<Integer>() {
60
61 @Override
62 protected Integer initialValue() {
63 return Integer.valueOf(0);
64 }
65 };/* How many chars have been consumed
66 * during parsing in signatureToString().
|