BashStreams.java revision 2362
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @summary Stochastic test of charset-based streams
*/
public class BashStreams {
static class CharacterGenerator {
private final int max;
private final int limit;
private int count = 0;
}
private char[] saved = new char[10];
private int savedCount = 0;
void push(char c) {
saved[savedCount++] = c;
count--;
}
int count() {
return count;
}
boolean hasNext() {
}
char next() {
throw new RuntimeException("EOF");
if (savedCount > 0) {
savedCount--;
count++;
return saved[savedCount];
}
int c;
for (;;) {
continue;
continue;
break;
}
count++;
count++;
}
return (char)c;
}
}
+ count
+ " != "
+ Integer.toHexString(d));
}
+ count
+ " != "
+ cgCount);
}
static class Sink // One abomination...
extends OutputStream
implements WritableByteChannel
{
private final CharacterGenerator cg;
private int count = 0;
}
public void write(int b) throws IOException {
}
int n = s.length();
for (int i = 0; i < n; i++) {
char c = s.charAt(i);
if (c != d) {
if (c == '?') {
continue;
}
}
}
count += n;
return len;
}
}
return n;
}
public void close() {
count = -1;
}
public boolean isOpen() {
return count >= 0;
}
}
throws IOException
{
int count = 0;
char[] ca = new char[16384];
int n = 0;
for (int i = 0; i < n; i++)
count += n;
}
w.close();
}
throws IOException
{
}
throws IOException
{
.newEncoder()
8192));
}
static class Source // ... and another
extends InputStream
implements ReadableByteChannel
{
private final CharsetEncoder enc;
private final CharacterGenerator cg;
private int count = 0;
}
public int read() throws IOException {
byte[] b = new byte[1];
read(b);
return b[0];
}
return -1;
int i = off;
while (i < end) {
while (cb.hasRemaining()) {
break;
break;
}
}
if (!cb.hasRemaining())
break;
}
i += d;
}
return i - off;
}
if (n >= 0)
return n;
}
public void close() {
count = -1;
}
public boolean isOpen() {
return count != -1;
}
}
throws IOException
{
int count = 0;
char[] ca = new char[16384];
int n = 0;
if (n < 0)
break;
for (int i = 0; i < n; i++) {
char c = ca[i];
if (c == '?') {
continue;
}
if (d > max)
continue;
}
if (c != d)
}
count += n;
}
}
throws IOException
{
}
throws IOException
{
}
throws Exception
{
}
// This test requires 54 minutes on an Itanium-1 processor
return;
}
int limit;
else
long seed;
else
}
}