/** * {@inheritDoc} */ @Override public int read() throws IOException { final boolean previousWasSlashR = slashRSeen; if ( eofSeen ) { return eofGame(previousWasSlashR); } else { final int target = readWithUpdate(); if ( eofSeen ) { return eofGame(previousWasSlashR); } if (slashRSeen) { return '\n'; } if ( previousWasSlashR && slashNSeen){ return read(); } return target; } }
private String roundtrip( final String msg, final boolean ensure ) throws IOException { final ByteArrayInputStream baos = new ByteArrayInputStream( msg.getBytes( "UTF-8" ) ); final UnixLineEndingInputStream lf = new UnixLineEndingInputStream( baos, ensure ); final byte[] buf = new byte[100]; final int read = lf.read( buf ); lf.close(); return new String( buf, 0, read, "UTF-8" ); }
/** * {@inheritDoc} */ @Override public int read() throws IOException { final boolean previousWasSlashR = slashRSeen; if ( eofSeen ) { return eofGame(previousWasSlashR); } else { final int target = readWithUpdate(); if ( eofSeen ) { return eofGame(previousWasSlashR); } if (slashRSeen) { return '\n'; } if ( previousWasSlashR && slashNSeen){ return read(); } return target; } }
/** * {@inheritDoc} */ @Override public int read() throws IOException { boolean previousWasSlashR = slashRSeen; if ( eofSeen ) { return eofGame(previousWasSlashR); } else { int target = readWithUpdate(); if ( eofSeen ) { return eofGame(previousWasSlashR); } if (slashRSeen) { return '\n'; } if ( previousWasSlashR && slashNSeen){ return read(); } return target; } }