public void truncate ( int offset ) throws IOException { if ( ( offset < 0 ) || ( offset > _write_pos ) ) throw new IOException ( "bad truncate offset" ) ; if ( _read_pos > offset ) _read_pos = offset ; if ( _mark_pos > offset ) _mark_pos = offset ; _write_pos = offset ; if ( _file_high > offset ) _file_high = offset ; moveWindow ( _write_pos ) ; }
Truncates buffered data to specified size . Can not be used to extend data . Repositions OutputStream at the end of truncated data . If current read offset or mark is past the new end of data it is moved at the new end .