예제 #1
0
            public void Delete()
            {
                transaction.CheckErrorState();
                try {
                    InitWrite();
                    EnsureCorrectBounds();

                    if (end > start)
                    {
                        // Remove the data,
                        transaction.RemoveAbsoluteBounds(start, end);
                    }
                    if (end < start)
                    {
                        // Should ever happen?
                        throw new ApplicationException("end < start");
                    }

                    transaction.FlushCache();
                } catch (IOException e) {
                    throw transaction.HandleIOException(e);
                } catch (OutOfMemoryException e) {
                    throw transaction.HandleMemoryException(e);
                }
            }
            public void SetLength(long value)
            {
                transaction.CheckErrorState();
                try {
                    InitWrite();
                    EnsureCorrectBounds();

                    long currentSize = end - start;
                    ShiftData(end, value - currentSize);

                    transaction.FlushCache();
                } catch (IOException e) {
                    throw transaction.HandleIOException(e);
                } catch (OutOfMemoryException e) {
                    throw transaction.HandleMemoryException(e);
                }
            }