Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
commons-io-1.4.jar - Apache Commons IO
commons-io-1.4.jar is the JAR file for Commons IO 1.4, which is a library of utilities to assist with developing IO functionality.
JAR File Size and Download Location:
JAR name: commons-io.jar, commons-io-1.4.jar Target JDK version: 1.3 Dependency: None File size: 109043 bytes Date modified: 16-Jan-2008 Download: Apache Commons IO Website
✍: FYIcenter.com
⏎ org/apache/commons/io/input/CharSequenceReader.java
/* * 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.commons.io.input; import java.io.Reader; import java.io.Serializable; /** * {@link Reader} implementation that can read from String, StringBuffer, * StringBuilder or CharBuffer. * <p> * <strong>Note:</strong> Supports {@link #mark(int)} and {@link #reset()}. * * @version $Revision: 610516 $ $Date: 2008-01-09 19:05:05 +0000 (Wed, 09 Jan 2008) $ * @since Commons IO 1.4 */ public class CharSequenceReader extends Reader implements Serializable { private final CharSequence charSequence; private int idx; private int mark; /** * Construct a new instance with the specified character sequence. * * @param charSequence The character sequence, may be <code>null</code> */ public CharSequenceReader(CharSequence charSequence) { this.charSequence = (charSequence != null ? charSequence : ""); } /** * Close resets the file back to the start and removes any marked position. */ public void close() { idx = 0; mark = 0; } /** * Mark the current position. * * @param readAheadLimit ignored */ public void mark(int readAheadLimit) { mark = idx; } /** * Mark is supported (returns true). * * @return <code>true</code> */ public boolean markSupported() { return true; } /** * Read a single character. * * @return the next character from the character sequence * or -1 if the end has been reached. */ public int read() { if (idx >= charSequence.length()) { return -1; } else { return charSequence.charAt(idx++); } } /** * Read the sepcified number of characters into the array. * * @param array The array to store the characters in * @param offset The starting position in the array to store * @param length The maximum number of characters to read * @return The number of characters read or -1 if there are * no more */ public int read(char[] array, int offset, int length) { if (idx >= charSequence.length()) { return -1; } if (array == null) { throw new NullPointerException("Character array is missing"); } if (length < 0 || (offset + length) > array.length) { throw new IndexOutOfBoundsException("Array Size=" + array.length + ", offset=" + offset + ", length=" + length); } int count = 0; for (int i = 0; i < length; i++) { int c = read(); if (c == -1) { return count; } array[offset + i] = (char)c; count++; } return count; } /** * Reset the reader to the last marked position (or the beginning if * mark has not been called). */ public void reset() { idx = mark; } /** * Skip the specified number of characters. * * @param n The number of characters to skip * @return The actual number of characters skipped */ public long skip(long n) { if (n < 0) { throw new IllegalArgumentException( "Number of characters to skip is less than zero: " + n); } if (idx >= charSequence.length()) { return -1; } int dest = (int)Math.min(charSequence.length(), (idx + n)); int count = dest - idx; idx = dest; return count; } /** * Return a String representation of the underlying * character sequence. * * @return The contents of the character sequence */ public String toString() { return charSequence.toString(); } }
⏎ org/apache/commons/io/input/CharSequenceReader.java
Or download all of them as a single archive file:
File name: commons-io-1.4-sources.jar File size: 280834 bytes Release date: 2008-01-16 Download
⇒ Using commons-io.jar in Java Code
2018-10-27, 47208👍, 0💬
Popular Posts:
What Is jniwrap.jar in JNIWrapper 3.7.1? winpack.jar in JNIWrapper 3.7.1 is an add-on JAR file for J...
Apache Commons Lang 3 is the 3rd version of Apache Commons Lang, which provides a host of helper uti...
JSP(tm) Standard Tag Library 1.1 implementation - Jakarta Taglibs hosts the Standard Taglib 1.1, an ...
What Is poi-contrib-3.5.jar? poi-contrib-3.5.jar is one of the JAR files for Apache POI 3.5, which p...
Apache Ant is a Java-based build tool. In theory, it is kind of like make, without make's wrinkles. ...