public ByteList fread(int number) throws IOException, BadDescriptorException, EOFException { if (number == 0) { if (stream.feof()) { return null; } else { return new ByteList(0); } } boolean eof = false; ByteList bl = new ByteList(number > ChannelStream.BUFSIZE ? ChannelStream.BUFSIZE : number); for (int i = 0; i < number; i++) { int c = fgetc(); if (c == -1) { eof = true; break; } bl.append(c); } if (eof && bl.length() == 0) { return null; } return bl; }
public ByteList fread(int number) throws IOException, BadDescriptorException, EOFException { if (number == 0) { if (stream.feof()) { return null; } else { return new ByteList(0); } } boolean eof = false; ByteList bl = new ByteList(number > ChannelStream.BUFSIZE ? ChannelStream.BUFSIZE : number); for (int i = 0; i < number; i++) { int c = fgetc(); if (c == -1) { eof = true; break; } bl.append(c); } if (eof && bl.length() == 0) { return null; } return bl; }
public ByteList fread(int number) throws IOException, BadDescriptorException, EOFException { if (number == 0) { if (stream.feof()) { return null; } else { return new ByteList(0); } } boolean eof = false; ByteList bl = new ByteList(number > ChannelStream.BUFSIZE ? ChannelStream.BUFSIZE : number); for (int i = 0; i < number; i++) { int c = fgetc(); if (c == -1) { eof = true; break; } bl.append(c); } if (eof && bl.length() == 0) { return null; } return bl; }
public ByteList fread(int number) throws IOException, BadDescriptorException, EOFException { if (number == 0) { if (stream.feof()) { return null; } else { return new ByteList(0); } } boolean eof = false; ByteList bl = new ByteList(number > ChannelStream.BUFSIZE ? ChannelStream.BUFSIZE : number); for (int i = 0; i < number; i++) { int c = fgetc(); if (c == -1) { eof = true; break; } bl.append(c); } if (eof && bl.length() == 0) { return null; } return bl; }