当前位置: 首页>>代码示例>>Java>>正文


Java Charset.equals方法代码示例

本文整理汇总了Java中java.nio.charset.Charset.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Charset.equals方法的具体用法?Java Charset.equals怎么用?Java Charset.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.nio.charset.Charset的用法示例。


在下文中一共展示了Charset.equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: StrictLineReader

import java.nio.charset.Charset; //导入方法依赖的package包/类
/**
 * Constructs a new {@code LineReader} with the specified capacity and charset.
 *
 * @param in the {@code InputStream} to read data from.
 * @param capacity the capacity of the buffer.
 * @param charset the charset used to decode data. Only US-ASCII, UTF-8 and ISO-8859-1 are
 * supported.
 * @throws NullPointerException if {@code in} or {@code charset} is null.
 * @throws IllegalArgumentException if {@code capacity} is negative or zero
 * or the specified charset is not supported.
 */
public StrictLineReader(InputStream in, int capacity, Charset charset) {
  if (in == null || charset == null) {
    throw new NullPointerException();
  }
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity <= 0");
  }
  if (!(charset.equals(Util.US_ASCII))) {
    throw new IllegalArgumentException("Unsupported encoding");
  }

  this.in = in;
  this.charset = charset;
  buf = new byte[capacity];
}
 
开发者ID:senierr,项目名称:ModuleFrame,代码行数:27,代码来源:StrictLineReader.java

示例2: StrictLineReader

import java.nio.charset.Charset; //导入方法依赖的package包/类
/**
 * Constructs a new {@code LineReader} with the specified capacity and charset.
 *
 * @param in the {@code InputStream} to read data from.
 * @param capacity the capacity of the buffer.
 * @param charset the charset used to decode data. Only US-ASCII, UTF-8 and ISO-8859-1 are
 * supported.
 * @throws NullPointerException if {@code in} or {@code charset} is null.
 * @throws IllegalArgumentException if {@code capacity} is negative or zero
 * or the specified charset is not supported.
 */
public StrictLineReader(InputStream in, int capacity, Charset charset) {
  if (in == null || charset == null) {
    throw new NullPointerException();
  }
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity <= 0");
  }
  if (!(charset.equals(IOUtil.US_ASCII))) {
    throw new IllegalArgumentException("Unsupported encoding");
  }

  this.in = in;
  this.charset = charset;
  buf = new byte[capacity];
}
 
开发者ID:SingleShu,项目名称:ImageLoaderLibrary,代码行数:27,代码来源:StrictLineReader.java

示例3: B2CConverter

import java.nio.charset.Charset; //导入方法依赖的package包/类
public B2CConverter(String encoding, boolean replaceOnError)
        throws IOException {
    byte[] left = new byte[LEFTOVER_SIZE];
    leftovers = ByteBuffer.wrap(left);
    CodingErrorAction action;
    if (replaceOnError) {
        action = CodingErrorAction.REPLACE;
    } else {
        action = CodingErrorAction.REPORT;
    }
    Charset charset = getCharset(encoding);
    // Special case. Use the Apache Harmony based UTF-8 decoder because it
    // - a) rejects invalid sequences that the JVM decoder does not
    // - b) fails faster for some invalid sequences
    if (charset.equals(UTF_8)) {
        decoder = new Utf8Decoder();
    } else {
        decoder = charset.newDecoder();
    }
    decoder.onMalformedInput(action);
    decoder.onUnmappableCharacter(action);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:23,代码来源:B2CConverter.java

示例4: StrictLineReader

import java.nio.charset.Charset; //导入方法依赖的package包/类
/**
 * Constructs a new {@code LineReader} with the specified capacity and charset.
 *
 * @param in       the {@code InputStream} to read data from.
 * @param capacity the capacity of the buffer.
 * @param charset  the charset used to decode data. Only US-ASCII, UTF-8 and ISO-8859-1 are
 *                 supported.
 * @throws NullPointerException     if {@code in} or {@code charset} is null.
 * @throws IllegalArgumentException if {@code capacity} is negative or zero
 *                                  or the specified charset is not supported.
 */
public StrictLineReader(InputStream in, int capacity, Charset charset) {
    if (in == null || charset == null) {
        throw new NullPointerException();
    }
    if (capacity < 0) {
        throw new IllegalArgumentException("capacity <= 0");
    }
    if (!(charset.equals(Util.US_ASCII))) {
        throw new IllegalArgumentException("Unsupported encoding");
    }

    this.in = in;
    this.charset = charset;
    buf = new byte[capacity];
}
 
开发者ID:xiaoyaoyou1212,项目名称:XSnow,代码行数:27,代码来源:DiskLruCache.java

示例5: B2CConverter

import java.nio.charset.Charset; //导入方法依赖的package包/类
public B2CConverter(String encoding, boolean replaceOnError) throws IOException {
	byte[] left = new byte[LEFTOVER_SIZE];
	leftovers = ByteBuffer.wrap(left);
	CodingErrorAction action;
	if (replaceOnError) {
		action = CodingErrorAction.REPLACE;
	} else {
		action = CodingErrorAction.REPORT;
	}
	Charset charset = getCharset(encoding);
	// Special case. Use the Apache Harmony based UTF-8 decoder because it
	// - a) rejects invalid sequences that the JVM decoder does not
	// - b) fails faster for some invalid sequences
	if (charset.equals(UTF_8)) {
		decoder = new Utf8Decoder();
	} else {
		decoder = charset.newDecoder();
	}
	decoder.onMalformedInput(action);
	decoder.onUnmappableCharacter(action);
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:22,代码来源:B2CConverter.java

示例6: StrictLineReader

import java.nio.charset.Charset; //导入方法依赖的package包/类
/**
 * Constructs a new {@code LineReader} with the specified capacity and charset.
 *
 * @param in the {@code InputStream} to read data from.
 * @param capacity the capacity of the buffer.
 * @param charset the charset used to decode data. Only US-ASCII, UTF-8 and ISO-8859-1 are
 * supported.
 * @throws NullPointerException if {@code in} or {@code charset} is null.
 * @throws IllegalArgumentException if {@code capacity} is negative or zero
 * or the specified charset is not supported.
 */
public StrictLineReader(InputStream in, int capacity, Charset charset) {
    if (in == null || charset == null) {
        throw new NullPointerException();
    }
    if (capacity < 0) {
        throw new IllegalArgumentException("capacity <= 0");
    }
    if (!(charset.equals(Util.US_ASCII))) {
        throw new IllegalArgumentException("Unsupported encoding");
    }

    this.in = in;
    this.charset = charset;
    buf = new byte[capacity];
}
 
开发者ID:yale8848,项目名称:CacheWebView,代码行数:27,代码来源:StrictLineReader.java

示例7: StrictLineReader

import java.nio.charset.Charset; //导入方法依赖的package包/类
/**
 * Constructs a new {@code LineReader} with the specified capacity and charset.
 *
 * @param in the {@code InputStream} to read data from.
 * @param capacity the capacity of the buffer.
 * @param charset the charset used to decode data. Only US-ASCII, UTF-8 and ISO-8859-1 are
 *     supported.
 * @throws NullPointerException if {@code in} or {@code charset} is null.
 * @throws IllegalArgumentException if {@code capacity} is negative or zero
 *     or the specified charset is not supported.
 */
public StrictLineReader(InputStream in, int capacity, Charset charset) {
  if (in == null || charset == null) {
    throw new NullPointerException();
  }
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity <= 0");
  }
  if (!(charset.equals(Util.US_ASCII))) {
    throw new IllegalArgumentException("Unsupported encoding");
  }

  this.in = in;
  this.charset = charset;
  buf = new byte[capacity];
}
 
开发者ID:aabognah,项目名称:LoRaWAN-Smart-Parking,代码行数:27,代码来源:StrictLineReader.java

示例8: StrictLineReader

import java.nio.charset.Charset; //导入方法依赖的package包/类
/**
 * Constructs a new {@code LineReader} with the specified capacity and charset.
 *
 * @param in       the {@code InputStream} to read data from.
 * @param capacity the capacity of the buffer.
 * @param charset  the charset used to decode data. Only US-ASCII, UTF-8 and ISO-8859-1 are
 *                 supported.
 * @throws NullPointerException     if {@code in} or {@code charset} is null.
 * @throws IllegalArgumentException if {@code capacity} is negative or zero
 *                                  or the specified charset is not supported.
 */
public StrictLineReader(InputStream in, int capacity, Charset charset) {
  if (in == null || charset == null) {
    throw new NullPointerException();
  }
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity <= 0");
  }
  if (!(charset.equals(Util.US_ASCII))) {
    throw new IllegalArgumentException("Unsupported encoding");
  }

  this.in = in;
  this.charset = charset;
  buf = new byte[capacity];
}
 
开发者ID:qiaodashaoye,项目名称:SuperHttp,代码行数:27,代码来源:DiskLruCache.java

示例9: StrictLineReader

import java.nio.charset.Charset; //导入方法依赖的package包/类
/**
 * Constructs a new {@code LineReader} with the specified capacity and charset.
 *
 * @param in the {@code InputStream} to read data from.
 * @param capacity the capacity of the buffer.
 * @param charset the charset used to decode data. Only US-ASCII, UTF-8 and ISO-8859-1 are
 * supported.
 * @throws NullPointerException if {@code in} or {@code charset} is null.
 * @throws IllegalArgumentException if {@code capacity} is negative or zero
 * or the specified charset is not supported.
 */
public StrictLineReader(InputStream in, int capacity, Charset charset) {
	if (in == null || charset == null) {
		throw new NullPointerException();
	}
	if (capacity < 0) {
		throw new IllegalArgumentException("capacity <= 0");
	}
	if (!(charset.equals(Util.US_ASCII))) {
		throw new IllegalArgumentException("Unsupported encoding");
	}

	this.in = in;
	this.charset = charset;
	buf = new byte[capacity];
}
 
开发者ID:Spencer231,项目名称:GifImageLoader,代码行数:27,代码来源:StrictLineReader.java

示例10: writeString

import java.nio.charset.Charset; //导入方法依赖的package包/类
public Buffer writeString(String string, int beginIndex, int endIndex, Charset charset) {
    if (string == null) {
        throw new IllegalArgumentException("string == null");
    } else if (beginIndex < 0) {
        throw new IllegalAccessError("beginIndex < 0: " + beginIndex);
    } else if (endIndex < beginIndex) {
        throw new IllegalArgumentException("endIndex < beginIndex: " + endIndex + " < " + beginIndex);
    } else if (endIndex > string.length()) {
        throw new IllegalArgumentException("endIndex > string.length: " + endIndex + " > " + string.length());
    } else if (charset == null) {
        throw new IllegalArgumentException("charset == null");
    } else if (charset.equals(Util.UTF_8)) {
        return writeUtf8(string);
    } else {
        byte[] data = string.substring(beginIndex, endIndex).getBytes(charset);
        return write(data, 0, data.length);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:Buffer.java

示例11: asCharSource

import java.nio.charset.Charset; //导入方法依赖的package包/类
@Override
public CharSource asCharSource(Charset charset) {
  if (charset.equals(this.charset)) {
    return CharSource.this;
  }
  return super.asCharSource(charset);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:8,代码来源:CharSource.java

示例12: asByteSource

import java.nio.charset.Charset; //导入方法依赖的package包/类
@Override
public ByteSource asByteSource(Charset charset) {
  if (charset.equals(this.charset)) {
    return ByteSource.this;
  }
  return super.asByteSource(charset);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:8,代码来源:ByteSource.java

示例13: StrictLineReader

import java.nio.charset.Charset; //导入方法依赖的package包/类
public StrictLineReader(InputStream in, int capacity, Charset charset) {
    if (in == null || charset == null) {
        throw new NullPointerException();
    } else if (capacity < 0) {
        throw new IllegalArgumentException("capacity <= 0");
    } else if (charset.equals(Util.US_ASCII)) {
        this.in = in;
        this.charset = charset;
        this.buf = new byte[capacity];
    } else {
        throw new IllegalArgumentException("Unsupported encoding");
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:14,代码来源:StrictLineReader.java

示例14: canonicalize

import java.nio.charset.Charset; //导入方法依赖的package包/类
static void canonicalize(Buffer out, String input, int pos, int limit, String encodeSet,
    boolean alreadyEncoded, boolean strict, boolean plusIsSpace, boolean asciiOnly,
    Charset charset) {
  Buffer encodedCharBuffer = null; // Lazily allocated.
  int codePoint;
  for (int i = pos; i < limit; i += Character.charCount(codePoint)) {
    codePoint = input.codePointAt(i);
    if (alreadyEncoded
        && (codePoint == '\t' || codePoint == '\n' || codePoint == '\f' || codePoint == '\r')) {
      // Skip this character.
    } else if (codePoint == '+' && plusIsSpace) {
      // Encode '+' as '%2B' since we permit ' ' to be encoded as either '+' or '%20'.
      out.writeUtf8(alreadyEncoded ? "+" : "%2B");
    } else if (codePoint < 0x20
        || codePoint == 0x7f
        || codePoint >= 0x80 && asciiOnly
        || encodeSet.indexOf(codePoint) != -1
        || codePoint == '%' && (!alreadyEncoded || strict && !percentEncoded(input, i, limit))) {
      // Percent encode this character.
      if (encodedCharBuffer == null) {
        encodedCharBuffer = new Buffer();
      }

      if (charset == null || charset.equals(Util.UTF_8)) {
        encodedCharBuffer.writeUtf8CodePoint(codePoint);
      } else {
        encodedCharBuffer.writeString(input, i, i + Character.charCount(codePoint), charset);
      }

      while (!encodedCharBuffer.exhausted()) {
        int b = encodedCharBuffer.readByte() & 0xff;
        out.writeByte('%');
        out.writeByte(HEX_DIGITS[(b >> 4) & 0xf]);
        out.writeByte(HEX_DIGITS[b & 0xf]);
      }
    } else {
      // This character doesn't need encoding. Just copy it over.
      out.writeUtf8CodePoint(codePoint);
    }
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:42,代码来源:HttpUrl.java

示例15: isAllowedEncoding

import java.nio.charset.Charset; //导入方法依赖的package包/类
protected boolean isAllowedEncoding(Charset enc)
{
    return enc.equals(VorbisHeader.CHARSET_UTF_8);
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:5,代码来源:VorbisCommentTag.java


注:本文中的java.nio.charset.Charset.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。