Coverage Summary for Class: Platform (com.google.common.escape)

Class Method, % Line, %
Platform 0% (0/3) 0% (0/3)
Platform$1 0% (0/2) 0% (0/2)
Total 0% (0/5) 0% (0/5)


1 /* 2  * Copyright (C) 2009 The Guava Authors 3  * 4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5  * in compliance with the License. You may obtain a copy of the License at 6  * 7  * http://www.apache.org/licenses/LICENSE-2.0 8  * 9  * Unless required by applicable law or agreed to in writing, software distributed under the License 10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11  * or implied. See the License for the specific language governing permissions and limitations under 12  * the License. 13  */ 14  15 package com.google.common.escape; 16  17 import com.google.common.annotations.GwtCompatible; 18  19 /** 20  * Methods factored out so that they can be emulated differently in GWT. 21  * 22  * @author Jesse Wilson 23  */ 24 @GwtCompatible(emulated = true) 25 @ElementTypesAreNonnullByDefault 26 final class Platform { 27  private Platform() {} 28  29  /** Returns a thread-local 1024-char array. */ 30  static char[] charBufferFromThreadLocal() { 31  return DEST_TL.get(); 32  } 33  34  /** 35  * A thread-local destination buffer to keep us from creating new buffers. The starting size is 36  * 1024 characters. If we grow past this we don't put it back in the threadlocal, we just keep 37  * going and grow as needed. 38  */ 39  private static final ThreadLocal<char[]> DEST_TL = 40  new ThreadLocal<char[]>() { 41  @Override 42  protected char[] initialValue() { 43  return new char[1024]; 44  } 45  }; 46 }