Mercurial > projects > dwt-linux
comparison dwt/internal/image/JPEGFixedSizeSegment.d @ 13:3d9bbe0a83a0
FileFormats
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 06 Jan 2008 22:54:14 +0100 |
parents | |
children | 8cec8f536af3 |
comparison
equal
deleted
inserted
replaced
12:0c78fa47d476 | 13:3d9bbe0a83a0 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2000, 2003 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 *******************************************************************************/ | |
11 module dwt.internal.image.JPEGFixedSizeSegment; | |
12 | |
13 | |
14 import dwt.SWT; | |
15 import dwt.internal.image.JPEGSegment; | |
16 import dwt.internal.image.LEDataInputStream; | |
17 | |
18 import tango.core.Exception; | |
19 | |
20 | |
21 abstract class JPEGFixedSizeSegment : JPEGSegment { | |
22 | |
23 public this() { | |
24 reference = new byte[fixedSize()]; | |
25 setSegmentMarker(signature()); | |
26 } | |
27 | |
28 public this(byte[] reference) { | |
29 super(reference); | |
30 } | |
31 | |
32 public this(LEDataInputStream byteStream) { | |
33 reference = new byte[fixedSize()]; | |
34 try { | |
35 byteStream.read(reference); | |
36 } catch (TracedException e) { | |
37 SWT.error(SWT.ERROR_IO, e); | |
38 } | |
39 } | |
40 | |
41 abstract public int fixedSize(); | |
42 | |
43 public int getSegmentLength() { | |
44 return fixedSize() - 2; | |
45 } | |
46 | |
47 public void setSegmentLength(int length) { | |
48 } | |
49 } |